sda.dashboard.errors.handlers#
Enhanced Error Handling Framework.
Comprehensive error handling system for dashboard callbacks and components.
Classes#
Error severity levels. |
|
Context where error occurred. |
|
Structured error information. |
|
Error recovery strategies. |
|
Centralized error handling system. |
Functions#
|
Create an error boundary component for displaying errors. |
|
Handle callback error with structured error handling. |
|
Get the global error handler instance. |
Module Contents#
- class sda.dashboard.errors.handlers.ErrorSeverity(*args, **kwds)#
Bases:
enum.EnumError severity levels.
- LOW = 'low'#
- MEDIUM = 'medium'#
- HIGH = 'high'#
- CRITICAL = 'critical'#
- class sda.dashboard.errors.handlers.ErrorContext(*args, **kwds)#
Bases:
enum.EnumContext where error occurred.
- CALLBACK = 'callback'#
- DATA_LOADING = 'data_loading'#
- PLOTTING = 'plotting'#
- FILTERING = 'filtering'#
- NAVIGATION = 'navigation'#
- INITIALIZATION = 'initialization'#
- class sda.dashboard.errors.handlers.DashboardError#
Structured error information.
- context: ErrorContext#
- severity: ErrorSeverity#
- timestamp: datetime.datetime#
- class sda.dashboard.errors.handlers.ErrorRecovery#
Error recovery strategies.
- static retry_with_backoff(func, max_retries=3)#
Retry function with exponential backoff.
- static fallback_to_default(func, default_value)#
Fallback to default value on error.
- static graceful_degradation(func, degraded_func)#
Fall back to degraded functionality on error.
- class sda.dashboard.errors.handlers.ErrorHandler(verbose=False)#
Centralized error handling system.
- verbose = False#
- handle_error(error, context, severity=ErrorSeverity.MEDIUM, callback_id=None, metadata=None)#
Handle an error with appropriate strategy.
- Parameters:
error (
Exception) – The exception that occurredcontext (
ErrorContext) – Context where error occurredseverity (
ErrorSeverity) – Severity level of the errorcallback_id (
Optional[str]) – ID of callback where error occurredmetadata (
Optional[Dict[str,Any]]) – Additional error metadata
- Returns:
Structured error information
- Return type:
- get_user_notifications()#
Get pending user notifications.
- clear_notifications()#
Clear user notifications.
- get_error_summary()#
Get summary of recent errors.
- sda.dashboard.errors.handlers.create_error_boundary(component_id)#
Create an error boundary component for displaying errors.
- Parameters:
component_id (
str) – ID for the error boundary component- Returns:
Error boundary component
- Return type:
html.Div
- sda.dashboard.errors.handlers.handle_callback_error(callback_id, error, context=ErrorContext.CALLBACK, severity=ErrorSeverity.MEDIUM, fallback_value=None)#
Handle callback error with structured error handling.
- Parameters:
callback_id (
str) – ID of the callback that failederror (
Exception) – The exception that occurredcontext (
ErrorContext) – Context where error occurredseverity (
ErrorSeverity) – Severity of the errorfallback_value (
Any) – Value to return on error
- Returns:
Fallback value or dash.no_update
- Return type:
Any