From 632bce8f33b7c219d803f7bca130e302723a8b3d Mon Sep 17 00:00:00 2001 From: wasrusgen Date: Sat, 16 May 2026 12:35:42 +0300 Subject: [PATCH] fix: wrap client_create/delete/update in try/except for proper error surfacing --- backend-py/app/main.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/backend-py/app/main.py b/backend-py/app/main.py index 25dea45..d8b5fda 100644 --- a/backend-py/app/main.py +++ b/backend-py/app/main.py @@ -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")