Step error handler
Error handling base class for pipeline steps.
References
NONE
BaseStepErrorHandler(log_level=logging.ERROR)
Bases: ABC
Abstract base class for error handling strategies.
Attributes:
| Name | Type | Description |
|---|---|---|
log_level |
int
|
The logging level to use when logging errors. |
logger |
Logger
|
The logger to use when logging errors. |
Initialize the error handler with a specific log level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_level |
int
|
The logging level to use when logging errors. Defaults to logging.ERROR. Common values: 1. logging.DEBUG: Detailed information for debugging. 2. logging.INFO: General information messages. 3. logging.WARNING: Warning messages. 4. logging.ERROR: Error messages (default). 5. logging.CRITICAL: Critical error messages. |
ERROR
|
handle(error, state, runtime, context)
Handle an error that occurred during pipeline step execution.
This method logs the error first, then delegates to the concrete implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error |
Exception
|
The exception that was raised. |
required |
state |
dict[str, Any]
|
The current pipeline state when the error occurred. |
required |
runtime |
Runtime[dict[str, Any] | BaseModel]
|
Runtime information for this step's execution. |
required |
context |
ErrorContext
|
Additional context about the error. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: State updates to apply, or None if no updates needed. |
Raises:
| Type | Description |
|---|---|
Exception
|
May raise exceptions based on the strategy implementation. |