define a base exception for engine
This commit is contained in:
parent
5209547a89
commit
756bffe868
@ -16,12 +16,14 @@ __all__ = (
|
||||
"DeprecatedError",
|
||||
)
|
||||
|
||||
class MongoEngineException(Exception):
|
||||
pass
|
||||
|
||||
class NotRegistered(Exception):
|
||||
class NotRegistered(MongoEngineException):
|
||||
pass
|
||||
|
||||
|
||||
class InvalidDocumentError(Exception):
|
||||
class InvalidDocumentError(MongoEngineException):
|
||||
pass
|
||||
|
||||
|
||||
@ -29,19 +31,19 @@ class LookUpError(AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
class DoesNotExist(Exception):
|
||||
class DoesNotExist(MongoEngineException):
|
||||
pass
|
||||
|
||||
|
||||
class MultipleObjectsReturned(Exception):
|
||||
class MultipleObjectsReturned(MongoEngineException):
|
||||
pass
|
||||
|
||||
|
||||
class InvalidQueryError(Exception):
|
||||
class InvalidQueryError(MongoEngineException):
|
||||
pass
|
||||
|
||||
|
||||
class OperationError(Exception):
|
||||
class OperationError(MongoEngineException):
|
||||
pass
|
||||
|
||||
|
||||
@ -57,7 +59,7 @@ class SaveConditionError(OperationError):
|
||||
pass
|
||||
|
||||
|
||||
class FieldDoesNotExist(Exception):
|
||||
class FieldDoesNotExist(MongoEngineException):
|
||||
"""Raised when trying to set a field
|
||||
not declared in a :class:`~mongoengine.Document`
|
||||
or an :class:`~mongoengine.EmbeddedDocument`.
|
||||
@ -155,7 +157,7 @@ class ValidationError(AssertionError):
|
||||
return " ".join([f"{k}: {v}" for k, v in error_dict.items()])
|
||||
|
||||
|
||||
class DeprecatedError(Exception):
|
||||
class DeprecatedError(MongoEngineException):
|
||||
"""Raise when a user uses a feature that has been Deprecated"""
|
||||
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user