fix: enhance error logging with exception info across multiple modules

This commit is contained in:
Alex
2025-05-05 13:12:39 +01:00
parent cf333873fd
commit 481df4d604
14 changed files with 37 additions and 30 deletions

View File

@@ -105,7 +105,7 @@ def get_agent_key(agent_id, user_id):
raise Exception("Unauthorized access to the agent", 403)
except Exception as e:
logger.error(f"Error in get_agent_key: {str(e)}")
logger.error(f"Error in get_agent_key: {str(e)}", exc_info=True)
raise
@@ -351,8 +351,7 @@ def complete_stream(
data = json.dumps({"type": "end"})
yield f"data: {data}\n\n"
except Exception as e:
logger.error(f"Error in stream: {str(e)}")
logger.error(traceback.format_exc())
logger.error(f"Error in stream: {str(e)}", exc_info=True)
data = json.dumps(
{
"type": "error",
@@ -882,6 +881,6 @@ def get_attachments_content(attachment_ids, user):
if attachment_doc:
attachments.append(attachment_doc)
except Exception as e:
logger.error(f"Error retrieving attachment {attachment_id}: {e}")
logger.error(f"Error retrieving attachment {attachment_id}: {e}", exc_info=True)
return attachments