Skip to content

Commit

Permalink
Merge pull request #2515 from par-tec/master
Browse files Browse the repository at this point in the history
define a base exception for engine
  • Loading branch information
bagerard committed Jun 6, 2021
2 parents 0df0585 + 5897b1d commit 7bf7153
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions mongoengine/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,35 @@
)


class NotRegistered(Exception):
class MongoEngineException(Exception):
pass


class InvalidDocumentError(Exception):
class NotRegistered(MongoEngineException):
pass


class InvalidDocumentError(MongoEngineException):
pass


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


Expand All @@ -57,7 +61,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`.
Expand Down Expand Up @@ -155,7 +159,7 @@ def generate_key(value, prefix=""):
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

0 comments on commit 7bf7153

Please sign in to comment.