Error Utils
Helpers for keeping errors inside the GLLM error taxonomy.
wrap_non_gllm_errors(to_gllm_error)
Re-raise GLLM errors unchanged and convert any other exception with to_gllm_error.
The converted error is chained to the original exception, so the original stays available as its
__cause__. The caller decides which GLLM error class to raise and what it records about the original.
Example
with wrap_non_gllm_errors(lambda e: MediaOperationFailedError(task="frame sampling")):
run_pipeline()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_gllm_error
|
Callable[[Exception], BaseError]
|
Builds the GLLM error to raise for an exception outside the taxonomy. |
required |
Yields:
| Name | Type | Description |
|---|---|---|
None |
None
|
Control to the guarded block. |
Raises:
| Type | Description |
|---|---|
BaseError
|
A GLLM taxonomy error raised by the block, preserved unchanged, or the error built by
|