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 SQLAlchemySupportError(SQLAthanorError): """Error raised when attempting to leverage a SQLAlchemy functionality that is not supported in your environment's version of SQLAlchemy.""" pass
[docs]class ConfigurationError(SQLAthanorError): """Error raised when the serialization confirmation does not match expectations.""" 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
[docs]class UnsupportedValueTypeError(DeserializationError): """Error raised when a value type found in a serialized string is not supported.""" pass
class FieldNotFoundError(SQLAthanorError): """Error raised when a Pydantic :class:`Field <pydantic:pydantic.fields.Field>` name is not found within a Pydantic :class:`BaseModel <pydantic:pydantic.main.BaseModel>`. """ pass