Exception Utils
Utility functions for exceptions.
normalize_errors(method)
Wraps a component method so any error that is not a BaseError becomes an UnexpectedError.
Apply this only to a method of a document-processing component: loader, parser, chunker, downloader, etc.
BaseErrorpasses through unchanged.BaseDocProcErrorwithoutcomponentis filled withtype(self).__name__where wrapped.- A
BaseErrorwith no reference ID gets one. - Any other error is re-raised as an
UnexpectedErrornaming the component class, chained from the original error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
Callable[Concatenate[Any, P], R]
|
The component method to wrap. |
required |
Returns:
| Type | Description |
|---|---|
Callable[Concatenate[Any, P], R]
|
Callable[Concatenate[Any, P], R]: The wrapped method. |