- Provides unified error handling across all application layers and external dependencies
- Maps internal errors to appropriate HTTP status codes and user-friendly messages
- Implements structured error logging with unique error IDs for debugging
- Handles errors from database, cache, authentication, and core library systems
- Supports specialized error types for numerical, statistical, and convergence failures
- Error Consolidation: Single error type encompassing all failure modes
- HTTP Response Mapping: Automatic conversion from internal errors to HTTP responses
- Structured Logging: Detailed error logging with correlation IDs and context
- User Experience: User-friendly error messages while preserving debug information
- Security: Prevents information leakage through careful error message filtering
- Developer Experience: Rich error context for debugging and troubleshooting
AppError enum: Comprehensive error type covering all application failure modes
ErrorContext: Internal error logging and ID generation for traceability
AppResult<T>: Type alias providing consistent error handling patterns
IntoResponse implementation: Automatic HTTP response generation from errors
- From trait implementations: Seamless conversion from external library errors
- Error Capture: Conversion from external library errors to unified AppError type
- Context Generation: Assignment of unique error IDs and structured logging
- Message Filtering: Separation of internal debug information from user messages
- HTTP Mapping: Translation of error types to appropriate HTTP status codes
- Response Formatting: JSON response construction with consistent structure
- Logging Integration: Structured logging with error IDs for correlation
- All Application Layers: Used throughout handlers, services, and data access layers
- External Libraries: Converts errors from SQLx, JWT, UUID, JSON, and core library
- HTTP Layer: Integrates with Axum framework for response generation
- Monitoring Systems: Provides error metrics and alerting integration points
- Logging Infrastructure: Coordinates with tracing system for structured logging
- Authentication System: Handles JWT and OAuth-related error conditions
- Result Type Propagation: Consistent error handling through Result<T, AppError> pattern
- Error Transformation: Systematic conversion from external to internal error types
- Logging with Correlation: Unique error IDs for distributed tracing and debugging
- Security-Conscious Messaging: Careful separation of internal and external error details
- HTTP Response Generation: Automatic mapping from domain errors to HTTP responses
- Structured Error Context: Rich error metadata for debugging and monitoring