diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2011-09-26 03:05:32 +0200 |
---|---|---|
committer | Sebastian Spaeth <Sebastian@SSpaeth.de> | 2011-09-29 09:16:34 +0200 |
commit | c16e47fe23901951399c9c463e82292a36462b73 (patch) | |
tree | 90504479a852018b2b82217e63989736eca4a8a5 /bindings/python/notmuch/globals.py | |
parent | fc2d353eeb074f3659df3ad60720d119480ab192 (diff) |
python: fix NotmuchError.__str__ if status == None
Passing None to STATUS.status2str raises an ArgumentError. Add a
check for this case and provide a generic message.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Diffstat (limited to 'bindings/python/notmuch/globals.py')
-rw-r--r-- | bindings/python/notmuch/globals.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py index 2a57c41..097ab96 100644 --- a/bindings/python/notmuch/globals.py +++ b/bindings/python/notmuch/globals.py @@ -99,8 +99,10 @@ class NotmuchError(Exception): def __str__(self): if self.message is not None: return self.message - else: + elif self.status is not None: return STATUS.status2str(self.status) + else: + return 'Unknown error' def _str(value): """Ensure a nicely utf-8 encoded string to pass to libnotmuch |