mirror of
https://github.com/wasrusgen/zov-tech.git
synced 2026-06-03 16:24:50 +00:00
fix: wrap client_create/delete/update in try/except for proper error surfacing
This commit is contained in:
parent
b3b62fa902
commit
632bce8f33
@ -270,19 +270,31 @@ async def api_client_note(request: Request):
|
||||
@app.post("/api/client_create")
|
||||
async def api_client_create(request: Request):
|
||||
body = await _safe_json(request)
|
||||
return _handle_client_create(body)
|
||||
try:
|
||||
return _handle_client_create(body)
|
||||
except Exception as e:
|
||||
log.exception("client_create error")
|
||||
return JSONResponse({"error": str(e)}, status_code=500)
|
||||
|
||||
|
||||
@app.post("/api/client_delete")
|
||||
async def api_client_delete(request: Request):
|
||||
body = await _safe_json(request)
|
||||
return _handle_client_delete(body)
|
||||
try:
|
||||
return _handle_client_delete(body)
|
||||
except Exception as e:
|
||||
log.exception("client_delete error")
|
||||
return JSONResponse({"error": str(e)}, status_code=500)
|
||||
|
||||
|
||||
@app.post("/api/client_update")
|
||||
async def api_client_update(request: Request):
|
||||
body = await _safe_json(request)
|
||||
return _handle_client_update(body)
|
||||
try:
|
||||
return _handle_client_update(body)
|
||||
except Exception as e:
|
||||
log.exception("client_update error")
|
||||
return JSONResponse({"error": str(e)}, status_code=500)
|
||||
|
||||
|
||||
@app.post("/api/measurement_design_upload")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user