Add exception handlers to FastAPI app.
(app)
| 132 | |
| 133 | |
| 134 | def add_exception_handlers(app): |
| 135 | """Add exception handlers to FastAPI app.""" |
| 136 | app.add_exception_handler(ValidationError, handle_validation_error) |
| 137 | app.add_exception_handler(SecurityError, handle_security_error) |
| 138 | app.add_exception_handler(ConfigurationError, handle_configuration_error) |
| 139 | app.add_exception_handler(WorkflowExecutionError, handle_workflow_execution_error) |
| 140 | app.add_exception_handler(ResourceNotFoundError, handle_resource_not_found_error) |
| 141 | app.add_exception_handler(ResourceConflictError, handle_resource_conflict_error) |
| 142 | app.add_exception_handler(TimeoutError, handle_timeout_error) |
| 143 | app.add_exception_handler(ExternalServiceError, handle_external_service_error) |
| 144 | app.add_exception_handler(MACException, handle_mac_exception) |
| 145 | app.add_exception_handler(Exception, handle_general_exception) |
| 146 | |
| 147 | return app |