Exceptions¶
Exception classes for marshmallow-related errors.
- exception marshmallow.exceptions.FieldInstanceResolutionError[source]¶
Raised when schema to instantiate is neither a Schema class nor an instance.
- exception marshmallow.exceptions.MarshmallowError[source]¶
Base class for all marshmallow-related errors.
- exception marshmallow.exceptions.RegistryError[source]¶
Raised when an invalid operation is performed on the serializer class registry.
- exception marshmallow.exceptions.StringNotCollectionError[source]¶
Raised when a string is passed when a list of strings is expected.
- exception marshmallow.exceptions.ValidationError(message, field_name='_schema', data=None, valid_data=None, **kwargs)[source]¶
Raised when validation fails on a field or schema.
Validators and custom fields should raise this exception.
- Parameters:
message (str | list | dict) – An error message, list of error messages, or dict of error messages. If a dict, the keys are subitems and the values are error messages.
field_name (str) – Field name to store the error on. If
None
, the error is stored as schema-level error.data (Mapping[str, Any] | Iterable[Mapping[str, Any]] | None) – Raw input data.
valid_data (list[dict[str, Any]] | dict[str, Any] | None) – Valid (de)serialized data.