Commit ·
a19ab2b
1
Parent(s): 4c3f624
Expose detailed error message on classification save failure
Browse files
api/routers/classification.py
CHANGED
|
@@ -107,10 +107,12 @@ async def save_classification(req: SaveClassificationReq, current_user: dict = D
|
|
| 107 |
state_data["current_step"] = 3
|
| 108 |
|
| 109 |
state_json = json.dumps(state_data, ensure_ascii=False, default=str)
|
| 110 |
-
safe_execute(
|
| 111 |
"UPDATE qto_active_projects SET current_step=3, state_data=%s WHERE user_id=%s AND project_id=%s",
|
| 112 |
(state_json, current_user["id"], req.project_id)
|
| 113 |
)
|
|
|
|
|
|
|
| 114 |
|
| 115 |
# Learning loop (API path): capture the user-confirmed page classifications so
|
| 116 |
# the AI improves over time. Approved rules are injected back into extraction
|
|
|
|
| 107 |
state_data["current_step"] = 3
|
| 108 |
|
| 109 |
state_json = json.dumps(state_data, ensure_ascii=False, default=str)
|
| 110 |
+
success, msg = safe_execute(
|
| 111 |
"UPDATE qto_active_projects SET current_step=3, state_data=%s WHERE user_id=%s AND project_id=%s",
|
| 112 |
(state_json, current_user["id"], req.project_id)
|
| 113 |
)
|
| 114 |
+
if not success:
|
| 115 |
+
raise HTTPException(status_code=500, detail=f"Failed to update database: {msg}")
|
| 116 |
|
| 117 |
# Learning loop (API path): capture the user-confirmed page classifications so
|
| 118 |
# the AI improves over time. Approved rules are injected back into extraction
|