status
¤
Status
¤
Bases: int
, Enum
Enumeration of the possible values that can be used in the return status of functions.
status_for_error
¤
status_for_error(error: BaseException) -> Status
Returns a Status that corresponds to the specified error.
status_for_output
¤
status_for_output(output: Any) -> Status
Returns a Status that corresponds to the specified output value.
register_error_type
¤
register_error_type(
error_type: Type[Exception],
status_or_handler: Union[
Status, Callable[[Exception], Status]
],
)
Register an error type to Status mapping.
The caller can either register a base exception and a handler, which derives a Status from errors of this type. Or, if there's only one exception to Status mapping to register, the caller can simply pass the exception class and the associated Status.
register_output_type
¤
register_output_type(
output_type: Type[Any],
status_or_handler: Union[
Status, Callable[[Any], Status]
],
)
Register an output type to Status mapping.
The caller can either register a base class and a handler, which derives a Status from other classes of this type. Or, if there's only one output class to Status mapping to register, the caller can simply pass the class and the associated Status.