-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Some except Exception blocks in the code could be more specific. Catching specific exceptions makes the code more robust and easier to debug.
Example
except Exception as e:
self.logger.error(f"Workflow failed: {e}", exc_info=True)
return {
"status": "error",
"error": str(e),
"workflow_duration_seconds": asyncio.get_event_loop().time() - workflow_start_time,
}Suggested Improvement
Instead of catching the generic Exception, we should catch more specific exceptions, such as ConfigurationError, LLMConnectionError, etc.
except ConfigurationError as e:
self.logger.error(f"Configuration failed: {e}", exc_info=True)
return {
"status": "error",
"error": f"Configuration error: {e}",
"workflow_duration_seconds": asyncio.get_event_loop().time() - workflow_start_time,
}
except LLMConnectionError as e:
self.logger.error(f"LLM connection failed: {e}", exc_info=True)
return {
"status": "error",
"error": f"LLM connection error: {e}",
"workflow_duration_seconds": asyncio.get_event_loop().time() - workflow_start_time,
}
except Exception as e:
self.logger.error(f"An unexpected error occurred: {e}", exc_info=True)
return {
"status": "error",
"error": f"An unexpected error occurred: {e}",
"workflow_duration_seconds": asyncio.get_event_loop().time() - workflow_start_time,
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request