aboutsummaryrefslogtreecommitdiffhomepage
path: root/bindings/python/notmuch/globals.py
diff options
context:
space:
mode:
authorGravatar Sebastian Spaeth <Sebastian@SSpaeth.de>2011-10-05 17:57:46 +0200
committerGravatar Sebastian Spaeth <Sebastian@SSpaeth.de>2011-10-05 17:57:46 +0200
commitdba9c313358c5852572a5e803500a1711735e775 (patch)
tree1d6cfa1ea717365f534464e0ce5af6231bba4026 /bindings/python/notmuch/globals.py
parent5e75398c80ab3008ca0ecd60544897dc5e546e47 (diff)
python: Set status in the class definitions
Technically, this is a superfluous change, as the self.status variable currently gets set in NotmuchErrors's __new__ function. However, in the long run I would like to get rid of the weird __new__ implementation which might be somewhat confusing for users (NotmuchError(status) returns a different class, e.g. OutOfMemoryError) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Diffstat (limited to 'bindings/python/notmuch/globals.py')
-rw-r--r--bindings/python/notmuch/globals.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py
index a42f2a40..de1db161 100644
--- a/bindings/python/notmuch/globals.py
+++ b/bindings/python/notmuch/globals.py
@@ -143,31 +143,32 @@ class NotmuchError(Exception):
# List of Subclassed exceptions that correspond to STATUS values and are
# subclasses of NotmuchError.
class OutOfMemoryError(NotmuchError):
- pass
+ status = STATUS.OUT_OF_MEMORY
class ReadOnlyDatabaseError(NotmuchError):
- pass
+ status = STATUS.READ_ONLY_DATABASE
class XapianError(NotmuchError):
- pass
+ status = STATUS.XAPIAN_EXCEPTION
class FileError(NotmuchError):
- pass
+ status = STATUS.FILE_ERROR
class FileNotEmailError(NotmuchError):
- pass
+ status = STATUS.FILE_NOT_EMAIL
class DuplicateMessageIdError(NotmuchError):
- pass
+ status = STATUS.DUPLICATE_MESSAGE_ID
class NullPointerError(NotmuchError):
- pass
+ status = STATUS.NULL_POINTER
class TagTooLongError(NotmuchError):
- pass
+ status = STATUS.TAG_TOO_LONG
class UnbalancedFreezeThawError(NotmuchError):
- pass
+ status = STATUS.UNBALANCED_FREEZE_THAW
class UnbalancedAtomicError(NotmuchError):
- pass
+ status = STATUS.UNBALANCED_ATOMIC
class NotInitializedError(NotmuchError):
"""Derived from NotmuchError, this occurs if the underlying data
structure (e.g. database is not initialized (yet) or an iterator has
been exhausted. You can test for NotmuchError with .status =
STATUS.NOT_INITIALIZED"""
- pass
+ status = STATUS.NOT_INITIALIZED
+
def _str(value):