Error handling
Utilities for handling errors and error contexts in the pipeline.
This module provides utilities for standardized error handling across the pipeline system.
References
NONE
ErrorContext
Bases: BaseModel
Standardized error context for pipeline steps.
This model provides a structured way to represent error context information for pipeline steps, ensuring consistency in error messages across the pipeline.
Attributes:
| Name | Type | Description |
|---|---|---|
exception |
BaseException
|
The exception that was raised. |
step_name |
str
|
The name of the pipeline step where the error occurred. |
step_type |
str
|
The type of pipeline step where the error occurred. |
state |
PipelineState | None
|
The pipeline state at the time of the error. Defaults to None. |
operation |
str
|
Description of the operation being performed when the error occurred. Defaults to "execution". |
additional_context |
str | None
|
Additional context to include in the error message. Defaults to None. |
__str__()
Convert the error context to a human-readable string.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
A formatted error message string. |
ValidationError(message)
Bases: Exception
Exception raised for errors in state validation.
This exception is raised when input validation fails in pipeline steps. It provides more specific error information than a generic RuntimeError.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
str
|
The error message explaining the validation failure. |
Initialize with an error message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message |
str
|
The error message explaining what validation failed. |
required |
create_error_context(exception, step_name, step_type, state, operation, **kwargs)
Create standardized error context for composite steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exception |
Exception
|
The exception that occurred. |
required |
step_name |
str
|
Name of the step. |
required |
step_type |
str
|
Type of the step. |
required |
state |
dict[str, Any]
|
Pipeline state at time of error. |
required |
operation |
str
|
Operation being performed. |
required |
**kwargs |
dict[str, Any]
|
Additional context key-value pairs. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
ErrorContext |
ErrorContext
|
ErrorContext object with standardized information. |