Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 23434431FD0 for ; Sun, 25 Sep 2011 18:06:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P7qRO5PVvMLv for ; Sun, 25 Sep 2011 18:06:29 -0700 (PDT) Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 8D7A5431FB6 for ; Sun, 25 Sep 2011 18:06:29 -0700 (PDT) Received: from mail.jade-hamburg.de (unknown [85.183.11.228]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cryptobitch.de (Postfix) with ESMTPSA id 6D21A505B23 for ; Mon, 26 Sep 2011 03:06:28 +0200 (CEST) Received: by mail.jade-hamburg.de (Postfix, from userid 401) id E4220DF2A6; Mon, 26 Sep 2011 03:06:27 +0200 (CEST) Received: from thinkbox.jade-hamburg.de (unknown [10.1.1.109]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: teythoon) by mail.jade-hamburg.de (Postfix) with ESMTPSA id B0C4DDF2A0; Mon, 26 Sep 2011 03:06:13 +0200 (CEST) Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.76) (envelope-from ) id 1R7ze5-0007OL-7P; Mon, 26 Sep 2011 03:06:09 +0200 From: Justus Winter <4winter@informatik.uni-hamburg.de> To: notmuch@notmuchmail.org Subject: [PATCH 4/9] python: fix NotmuchError.__str__ if status == None Date: Mon, 26 Sep 2011 03:05:32 +0200 Message-Id: <1316999137-28257-4-git-send-email-4winter@informatik.uni-hamburg.de> X-Mailer: git-send-email 1.7.6.3 In-Reply-To: <1316999137-28257-1-git-send-email-4winter@informatik.uni-hamburg.de> References: <1316999137-28257-1-git-send-email-4winter@informatik.uni-hamburg.de> X-Mailman-Approved-At: Mon, 26 Sep 2011 09:17:56 -0700 Cc: Justus Winter <4winter@informatik.uni-hamburg.de> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 01:06:30 -0000 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