Error extractor
Public facade for error extraction.
BaseErrorExtractor(provider_strategy)
Error extractor facade.
This class provides a simple interface for parsing provider errors by delegating to a list of extraction strategies. It is the main entry point used by invokers.
Initialize the error resolver with error extraction strategies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider_strategy
|
list[BaseExtractionStrategy]
|
List of extraction strategies. |
required |
resolve(error, class_name)
Resolve a provider error to a BaseInvokerError.
This is the main method called by invokers to convert provider-specific errors into standardized BaseInvokerError subclasses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error
|
Exception
|
The raw provider error to resolve. |
required |
class_name
|
str
|
The invoker class name for error context. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
BaseInvokerError |
BaseInvokerError
|
The resolved error with appropriate type and debug info. |
make_provider_extractor(strategy_classes)
Create a BaseErrorExtractor subclass configured with the given provider strategy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strategy_classes
|
type[BaseExtractionStrategy] | list[type[BaseExtractionStrategy]]
|
A single strategy class or list of strategy classes. If a single class is provided, CommonExtractionStrategy is automatically appended. If a list is provided, CommonExtractionStrategy is appended only if not already present. |
required |
Returns:
| Type | Description |
|---|---|
type[BaseErrorExtractor]
|
type[BaseErrorExtractor]: A configured extractor subclass. |
Raises:
| Type | Description |
|---|---|
TypeError
|
|
ValueError
|
If primary strategy class name does not end with 'ExtractionStrategy'. |