marsh.errors
¶
Collection of common errors used throughout the framework.
- exception MarshError(*args, path='')[source]¶
Base class for marsh errors.
Allows tracking of the path that produced the error.
- Parameters:
*args – General exception arguments.
path (
str
) – The path that produced the error.
- Return type:
None
- exception PathError(*args, path='')[source]¶
Accessing non-existing fields or indices.
Also used for path formatting errors.
- Parameters:
path (str) –
- Return type:
None
- exception UnmarshalError(msg='', path='', element='???', type='???')[source]¶
Failure to unmarshal an element to a specific type.
- exception MissingValueError(msg='', path='', element='???', type='???')[source]¶
Required value is missing.
- exception MarshalError(*args, path='')[source]¶
Failure to serialize a value.
- Parameters:
path (str) –
- Return type:
None
- exception ConfigFileError(*args, path='')[source]¶
Base error for config files.
- Parameters:
path (str) –
- Return type:
None
- maybe_handle_error(callback: Callable[[MarshError], Any]) contextlib.AbstractContextManager [source]¶
- maybe_handle_error(callback: Callable[[_E], Any], error: Type[_E]) contextlib.AbstractContextManager
Context manager that invokes a callback when catching an error.
The error is propagated and the callback ignored if the environmental variable
MARSH_FULL_ERROR
is set and not empty.The error is passed to the callback.