sda.dashboard.errors#

Error Handling Framework.


Enhanced error handling for dashboard callbacks and components.

Submodules#

Classes#

DashboardError

Structured error information.

ErrorContext

Context where error occurred.

ErrorHandler

Centralized error handling system.

ErrorRecovery

Error recovery strategies.

ErrorSeverity

Error severity levels.

Functions#

create_error_boundary(component_id)

Create an error boundary component for displaying errors.

get_error_handler([verbose])

Get the global error handler instance.

handle_callback_error(callback_id, error[, context, ...])

Handle callback error with structured error handling.

Package Contents#

class sda.dashboard.errors.DashboardError#

Structured error information.

error: Exception#
context: ErrorContext#
severity: ErrorSeverity#
timestamp: datetime.datetime#
callback_id: str | None = None#
user_message: str | None = None#
technical_details: str | None = None#
recovery_actions: List[str] = []#
metadata: Dict[str, Any]#
class sda.dashboard.errors.ErrorContext(*args, **kwds)#

Bases: enum.Enum

Context where error occurred.

CALLBACK = 'callback'#
DATA_LOADING = 'data_loading'#
PLOTTING = 'plotting'#
FILTERING = 'filtering'#
NAVIGATION = 'navigation'#
INITIALIZATION = 'initialization'#
class sda.dashboard.errors.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 occurred

  • context (ErrorContext) – Context where error occurred

  • severity (ErrorSeverity) – Severity level of the error

  • callback_id (Optional[str]) – ID of callback where error occurred

  • metadata (Optional[Dict[str, Any]]) – Additional error metadata

Returns:

Structured error information

Return type:

DashboardError

get_user_notifications()#

Get pending user notifications.

clear_notifications()#

Clear user notifications.

get_error_summary()#

Get summary of recent errors.

class sda.dashboard.errors.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.ErrorSeverity(*args, **kwds)#

Bases: enum.Enum

Error severity levels.

LOW = 'low'#
MEDIUM = 'medium'#
HIGH = 'high'#
CRITICAL = 'critical'#
sda.dashboard.errors.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.get_error_handler(verbose=False)#

Get the global error handler instance.

Parameters:

verbose (bool) – Whether to enable verbose logging

Returns:

Global error handler instance

Return type:

ErrorHandler

sda.dashboard.errors.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 failed

  • error (Exception) – The exception that occurred

  • context (ErrorContext) – Context where error occurred

  • severity (ErrorSeverity) – Severity of the error

  • fallback_value (Any) – Value to return on error

Returns:

Fallback value or dash.no_update

Return type:

Any