Source code for sqlathanor.errors

# -*- coding: utf-8 -*-

# The lack of a module docstring for this module is **INTENTIONAL**.
# The module is imported into the documentation using Sphinx's autodoc
# extension, and its member class documentation is automatically incorporated
# there as needed.

import warnings

[docs]class SQLAthanorError(ValueError): """Base error raised by **SQLAthanor**. Inherits from :class:`ValueError <python:ValueError>`. """ pass
[docs]class SQLAthanorWarning(UserWarning): """Base warning raised by **SQLAthanor**. Inherits from :class:`UserWarning <python:warnings.UserWarning>`.""" pass
[docs]class SerializationError(SQLAthanorError): """Error raised when something went wrong during serialization.""" pass
[docs]class SerializableAttributeError(SerializationError): """Error raised when there are no serializable attributes on a model instance.""" pass
[docs]class DeserializationError(SQLAthanorError): """Error raised when something went wrong during de-serialization.""" pass
[docs]class YAMLParseError(DeserializationError): """Error raised when something went wrong parsing input YAML data.""" pass
[docs]class JSONParseError(DeserializationError): """Error raised when something went wrong parsing input JSON data.""" pass
[docs]class ValueSerializationError(SerializationError): """Error raised when an attribute value fails the serialization process.""" pass
[docs]class DeserializableAttributeError(DeserializationError): """Error raised when there are no de-serializable attributes on a model instance or an inbound data source is empty.""" pass
[docs]class MaximumNestingExceededError(ValueSerializationError): """Error raised when the maximum permitted nesting is exceeded during serialization.""" pass
[docs]class MaximumNestingExceededWarning(SQLAthanorWarning): """Warning raised when the maximum permitted nesting is exceeded during serialization.""" pass
[docs]class ValueDeserializationError(DeserializationError): """Error raised when an attribute value fails the de-serialization process.""" pass
[docs]class InvalidFormatError(SQLAthanorError): """Error raised when supplying a format that is not recognized by **SQLAthanor**.""" pass
[docs]class UnsupportedSerializationError(SerializationError): """Error raised when attempting to serialize an attribute that does not support serialization.""" pass
[docs]class UnsupportedDeserializationError(DeserializationError): """Error raised when attempting to de-serialize an attribute that does not support de-serialization.""" pass
[docs]class CSVStructureError(DeserializationError): """Error raised when there is a mismatch between expected columns and found columns in CSV data.""" pass
[docs]class ExtraKeyError(DeserializationError): """Error raised when an inbound object being de-serialized has extra (unrecognized) keys.""" pass