Skip to content

Exception Utils

Utility functions for exceptions.

normalize_errors(method)

Wraps a component method so any error that is not a BaseError becomes an UnexpectedError.

Errors that already are a BaseError pass through unchanged. Any other error is re-raised as an UnexpectedError naming 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.