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

View File

@@ -2755,7 +2755,7 @@ class GetChunks(Resource):
)
except Exception as e:
current_app.logger.error(f"Error getting chunks: {e}")
current_app.logger.error(f"Error getting chunks: {e}", exc_info=True)
return make_response(jsonify({"success": False}), 500)
@@ -2809,7 +2809,7 @@ class AddChunk(Resource):
201,
)
except Exception as e:
current_app.logger.error(f"Error adding chunk: {e}")
current_app.logger.error(f"Error adding chunk: {e}", exc_info=True)
return make_response(jsonify({"success": False}), 500)
@@ -2849,7 +2849,7 @@ class DeleteChunk(Resource):
404,
)
except Exception as e:
current_app.logger.error(f"Error deleting chunk: {e}")
current_app.logger.error(f"Error deleting chunk: {e}", exc_info=True)
return make_response(jsonify({"success": False}), 500)
@@ -2931,7 +2931,7 @@ class UpdateChunk(Resource):
200,
)
except Exception as e:
current_app.logger.error(f"Error updating chunk: {e}")
current_app.logger.error(f"Error updating chunk: {e}", exc_info=True)
return make_response(jsonify({"success": False}), 500)