Exceptions

Exceptions defined by Odin.

Exceptions raised by Odin.

exception odin.exceptions.CodecDecodeError[source]

Exception raised by a codec during a decoding operation.

exception odin.exceptions.CodecEncodeError[source]

Exception raised by a codec during an encoding operation.

exception odin.exceptions.CodecError[source]

Exception raised by a codec during an operation.

exception odin.exceptions.InvalidPathError(path, *args, **kwargs)[source]

Raised when a path is invalid (eg referencing an unknown field)

exception odin.exceptions.MappingError[source]

Exceptions related to mapping, will typically be a more specific MappingSetupError or MappingExecutionError.

exception odin.exceptions.MappingExecutionError[source]

Exception raised during the execution of mapping rules.

exception odin.exceptions.MappingSetupError[source]

Exception raised during the setup of mapping rules.

exception odin.exceptions.MultipleMatchesError(path, *args, **kwargs)[source]

When traversing a path to get a single value, a filtering operation matched multiple values.

exception odin.exceptions.NoMatchError(path, *args, **kwargs)[source]

When traversing a path to get a value no match was found.

exception odin.exceptions.ResourceDefError[source]

Exceptions raised if a resource definition contains errors.

exception odin.exceptions.ResourceException(message: Union[Dict[str, List], List, str], code: str = None, params=None)[source]

Errors raised when generating resource from files.

Exception inherits from ValidationError for backwards compatibility.

exception odin.exceptions.TraversalError(path, *args, **kwargs)[source]

Exception raised during a traversal operation.

exception odin.exceptions.ValidationError(message: Union[Dict[str, List], List, str], code: str = None, params=None)[source]

An error while validating data.

error_messages

Return error messages.

classmethod for_field(field_name: str, message: Union[str, List[str]], *, code: str = None, params=None)[source]

Create an exception related to a specific field.

Parameters:
  • field_name – Name of the field error(s) are for.
  • message – Single or list of messages for field.
  • code – Optional code related to the error.
  • params – Optional parameters related to the error.
update_error_dict(error_dict: Dict[str, Union[List, Dict[str, List]]])[source]

Update a dict with errors from this exception.