[docs]classMultipleObjectsReturned(NotExistOrMultiple):""" The MultipleObjectsReturned exception is raised when doing a ``.get()`` operation, and more than one object is returned. """TEMPLATE='Multiple objects returned for "{}", expected exactly one'
[docs]classObjectDoesNotExistError(OperationalError,KeyError):""" The DoesNotExist exception is raised when an item with the passed primary key does not exist """def__init__(self,model:"Type[Model]",pk_name:str,pk_val:Any):self.model:"Type[Model]"=modelself.pk_name:str=pk_nameself.pk_val:Any=pk_valdef__str__(self):returnf"{self.model.__name__} has no object with {self.pk_name}={self.pk_val}"
[docs]classDoesNotExist(NotExistOrMultiple):""" The DoesNotExist exception is raised when expecting data, such as a ``.get()`` operation. """TEMPLATE='Object "{}" does not exist'
[docs]classIncompleteInstanceError(OperationalError):""" The IncompleteInstanceError exception is raised when a partial model is attempted to be persisted. """
[docs]classDBConnectionError(BaseORMException,ConnectionError):""" The DBConnectionError is raised when problems with connecting to db occurs """
[docs]classValidationError(BaseORMException):""" The ValidationError is raised when validators of field validate failed. """
[docs]classUnSupportedError(BaseORMException):""" The UnSupportedError is raised when operation is not supported. """