chromatictools.functional module¶
Utilities for handling and wrapping functions
- chromatictools.functional.recast_exception(type_a: Union[Type[Exception], Tuple[Type[Exception], ...]], type_b: Type[Exception])¶
Function decorator for wrapping a function: when that function would have raised an Exception in
type_a, now it will return atype_bexception- Parameters
type_a (type(s) of exception) – A subclass of
Exceptionor a tuple of subclasses. These exceptions will be recasttype_b (type of exception) – New type for recast exceptions
- Returns
Function decorator