From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 26 Sep 2011 01:05:32 +0000 (+0200) Subject: python: fix NotmuchError.__str__ if status == None X-Git-Tag: 0.9~40 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=c16e47fe23901951399c9c463e82292a36462b73 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> --- diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py index 2a57c411..097ab968 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