From: Justus Winter <4winter@informatik.uni-hamburg.de>
To: notmuch@notmuchmail.org
Cc: Justus Winter <4winter@informatik.uni-hamburg.de>
Subject: [PATCH 4/9] python: fix NotmuchError.__str__ if status == None
Date: Mon, 26 Sep 2011 03:05:32 +0200 [thread overview]
Message-ID: <1316999137-28257-4-git-send-email-4winter@informatik.uni-hamburg.de> (raw)
In-Reply-To: <1316999137-28257-1-git-send-email-4winter@informatik.uni-hamburg.de>
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 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py
index dd0c858..8b73f91 100644
--- a/bindings/python/notmuch/globals.py
+++ b/bindings/python/notmuch/globals.py
@@ -97,8 +97,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
--
1.7.6.3
next prev parent reply other threads:[~2011-09-26 1:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-26 1:05 [PATCH 1/9] python: add a .gitignore file and refine the toplevel one Justus Winter
2011-09-26 1:05 ` [PATCH 2/9] python: add status and message attributes to NotmuchError Justus Winter
2011-09-26 1:05 ` [PATCH 3/9] python: reorder the arguments of NotmuchError.__init__() Justus Winter
2011-09-26 1:05 ` Justus Winter [this message]
2011-09-26 1:05 ` [PATCH 5/9] python: rename _verify_initialized_db to _assert_db_is_initialized Justus Winter
2011-09-26 1:05 ` [PATCH 6/9] python: rename _verify_dir_initialized to _assert_dir_is_initialized Justus Winter
2011-09-26 1:05 ` [PATCH 7/9] python: provide more exception classes Justus Winter
2011-09-30 12:00 ` Sebastian Spaeth
2011-09-30 12:23 ` Justus Winter
2011-09-26 1:05 ` [PATCH 8/9] python: use the new exception classes and update the documentation Justus Winter
2011-09-26 1:05 ` [PATCH 9/9] python: raise a more specific error in Messages.print_messages Justus Winter
2011-09-29 7:45 ` [PATCH 1/9] python: add a .gitignore file and refine the toplevel one Sebastian Spaeth
2011-09-30 0:41 ` Justus Winter
2011-09-30 9:14 ` Sebastian Spaeth
2011-09-29 7:47 ` Sebastian Spaeth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1316999137-28257-4-git-send-email-4winter@informatik.uni-hamburg.de \
--to=4winter@informatik.uni-hamburg.de \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).