From c16e47fe23901951399c9c463e82292a36462b73 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 26 Sep 2011 03:05:32 +0200 Subject: [PATCH] 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> --- bindings/python/notmuch/globals.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.43.0