1 Return-Path: <teythoon@jade-hamburg.de>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id F0204431FD0
\r
6 for <notmuch@notmuchmail.org>; Sun, 25 Sep 2011 18:06:20 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 4fcheKRC21b6 for <notmuch@notmuchmail.org>;
\r
16 Sun, 25 Sep 2011 18:06:20 -0700 (PDT)
\r
17 Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68])
\r
18 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 7FC21431FB6
\r
21 for <notmuch@notmuchmail.org>; Sun, 25 Sep 2011 18:06:20 -0700 (PDT)
\r
22 Received: from mail.jade-hamburg.de (unknown [85.183.11.228])
\r
23 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
24 (No client certificate requested)
\r
25 by mail.cryptobitch.de (Postfix) with ESMTPSA id 5F92B505B23
\r
26 for <notmuch@notmuchmail.org>; Mon, 26 Sep 2011 03:06:19 +0200 (CEST)
\r
27 Received: by mail.jade-hamburg.de (Postfix, from userid 401)
\r
28 id CFDC2DF2A7; Mon, 26 Sep 2011 03:06:18 +0200 (CEST)
\r
29 Received: from thinkbox.jade-hamburg.de (unknown [10.1.1.109])
\r
30 (using TLSv1 with cipher AES256-SHA (256/256 bits))
\r
31 (No client certificate requested) (Authenticated sender: teythoon)
\r
32 by mail.jade-hamburg.de (Postfix) with ESMTPSA id D3B90DF28B;
\r
33 Mon, 26 Sep 2011 03:06:11 +0200 (CEST)
\r
34 Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.76)
\r
35 (envelope-from <teythoon@thinkbox.jade-hamburg.de>)
\r
36 id 1R7ze4-0007OG-To; Mon, 26 Sep 2011 03:06:08 +0200
\r
37 From: Justus Winter <4winter@informatik.uni-hamburg.de>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH 2/9] python: add status and message attributes to NotmuchError
\r
40 Date: Mon, 26 Sep 2011 03:05:30 +0200
\r
42 <1316999137-28257-2-git-send-email-4winter@informatik.uni-hamburg.de>
\r
43 X-Mailer: git-send-email 1.7.6.3
\r
45 <1316999137-28257-1-git-send-email-4winter@informatik.uni-hamburg.de>
\r
47 <1316999137-28257-1-git-send-email-4winter@informatik.uni-hamburg.de>
\r
48 X-Mailman-Approved-At: Mon, 26 Sep 2011 09:17:56 -0700
\r
49 Cc: Justus Winter <4winter@informatik.uni-hamburg.de>
\r
50 X-BeenThere: notmuch@notmuchmail.org
\r
51 X-Mailman-Version: 2.1.13
\r
53 List-Id: "Use and development of the notmuch mail system."
\r
54 <notmuch.notmuchmail.org>
\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
58 List-Post: <mailto:notmuch@notmuchmail.org>
\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
62 X-List-Received-Date: Mon, 26 Sep 2011 01:06:21 -0000
\r
64 Providing exception objects with meaningful attribute names
\r
65 is much nicer than using e.args[].
\r
67 Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
\r
69 bindings/python/notmuch/globals.py | 9 +++++----
\r
70 1 files changed, 5 insertions(+), 4 deletions(-)
\r
72 diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py
\r
73 index 05b9962..779ba5f 100644
\r
74 --- a/bindings/python/notmuch/globals.py
\r
75 +++ b/bindings/python/notmuch/globals.py
\r
76 @@ -91,13 +91,14 @@ STATUS.__name__ = 'STATUS'
\r
77 class NotmuchError(Exception):
\r
78 def __init__(self, status=None, message=None):
\r
79 """Is initiated with a (notmuch.STATUS[,message=None])"""
\r
80 - super(NotmuchError, self).__init__(message, status)
\r
81 + self.status = status
\r
82 + self.message = message
\r
85 - if self.args[0] is not None:
\r
86 - return self.args[0]
\r
87 + if self.message is not None:
\r
88 + return self.message
\r
90 - return STATUS.status2str(self.args[1])
\r
91 + return STATUS.status2str(self.status)
\r
94 """Ensure a nicely utf-8 encoded string to pass to libnotmuch
\r