Skip to content

Commit a3b89bf

Browse files
committed
fix(set-workspace): wrap override persistence to keep 500 as JSON (CodeRabbit on PR #22)
validate_workspace_path() failures were already returning structured JSON, but set_workspace_path_override(canonical) was outside the try block — a persistence failure would have surfaced as Flask's HTML 500 page instead of {"error": "..."}. Wraps the call in its own try/except so the response shape stays structured for any consumer parsing JSON.
1 parent a63297f commit a3b89bf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

api/config_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ def set_workspace():
9696
return jsonify({"error": str(e)}), 400
9797
except Exception: # noqa: BLE001 — only here as a fallback
9898
return jsonify({"error": "Failed to validate workspace path"}), 500
99-
set_workspace_path_override(canonical)
99+
try:
100+
set_workspace_path_override(canonical)
101+
except Exception: # noqa: BLE001 — keep the response shape structured JSON
102+
return jsonify({"error": "Failed to set workspace path"}), 500
100103
return jsonify({"success": True, "path": canonical})
101104

102105

0 commit comments

Comments
 (0)