Skip to content

Commit 47b0782

Browse files
Log exceptions on endpints
1 parent 25a67d0 commit 47b0782

File tree

2 files changed

+5
-135
lines changed

2 files changed

+5
-135
lines changed

src/codegate/api/dashboard/dashboard.py

-134
This file was deleted.

src/codegate/api/v1.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,15 @@ async def get_workspace_alerts(workspace_name: str) -> List[Optional[v1_models.A
202202
except crud.WorkspaceDoesNotExistError:
203203
raise HTTPException(status_code=404, detail="Workspace does not exist")
204204
except Exception:
205+
logger.exception("Error while getting workspace")
205206
raise HTTPException(status_code=500, detail="Internal server error")
206207

207208
try:
208-
alerts = await dbreader.get_alerts_with_prompt_and_output(ws.id)
209+
alerts = await dbreader.get_alerts_by_workspace(ws.id)
209210
prompts_outputs = await dbreader.get_prompts_with_output(ws.id)
210211
return await v1_processing.parse_get_alert_conversation(alerts, prompts_outputs)
211212
except Exception:
213+
logger.exception("Error while getting alerts and messages")
212214
raise HTTPException(status_code=500, detail="Internal server error")
213215

214216

@@ -224,13 +226,15 @@ async def get_workspace_messages(workspace_name: str) -> List[v1_models.Conversa
224226
except crud.WorkspaceDoesNotExistError:
225227
raise HTTPException(status_code=404, detail="Workspace does not exist")
226228
except Exception:
229+
logger.exception("Error while getting workspace")
227230
raise HTTPException(status_code=500, detail="Internal server error")
228231

229232
try:
230233
prompts_outputs = await dbreader.get_prompts_with_output(ws.id)
231234
conversations, _ = await v1_processing.parse_messages_in_conversations(prompts_outputs)
232235
return conversations
233236
except Exception:
237+
logger.exception("Error while getting messages")
234238
raise HTTPException(status_code=500, detail="Internal server error")
235239

236240

0 commit comments

Comments
 (0)