1 Return-Path: <mattator@gmail.com>
\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 657F7431FC4
\r
6 for <notmuch@notmuchmail.org>; Mon, 15 Dec 2014 12:46:44 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id ZkRZArj35Ct9 for <notmuch@notmuchmail.org>;
\r
17 Mon, 15 Dec 2014 12:46:41 -0800 (PST)
\r
18 Received: from mail-qa0-f48.google.com (mail-qa0-f48.google.com
\r
19 [209.85.216.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 1EBA6431FAF
\r
22 for <notmuch@notmuchmail.org>; Mon, 15 Dec 2014 12:46:41 -0800 (PST)
\r
23 Received: by mail-qa0-f48.google.com with SMTP id v10so8648580qac.21
\r
24 for <notmuch@notmuchmail.org>; Mon, 15 Dec 2014 12:46:40 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
\r
28 bh=A/zw5n3vMoZnapi8hlyv4MGR+qU2RaT6ivCEzu3LO30=;
\r
29 b=jXCH5Qgcjy+Gp+f5hvJ5Ar+6rwF8bCgihjAMWgU1TtGvyA7c5hs6GY0UlF59PRR785
\r
30 otvLajJ6AmrmPinTihHXH7isws0jiJ47TCSaLWDQyIX0gKEjKq1zgqPzIG5v3yAQd28R
\r
31 b44A3GI67AhQBq4tOhBg0w41O11PwaTs0qUKapwnQG4MOyZqc/YFPKsBL9Kx4JBF5dVs
\r
32 CH3o9ROfS32/DeeStK3qUwbtye6xqIdiIIhteCAqKz+kODhy3tit8GkyoJy3LPQ//aDD
\r
33 C4iw7eoC//VCV020M41xDdTdnXlT2FWV70dmXSATiCcxvMEalbl08i0oxsejKKx7ctmq
\r
36 X-Received: by 10.140.85.104 with SMTP id m95mr55358337qgd.93.1418676400496;
\r
37 Mon, 15 Dec 2014 12:46:40 -0800 (PST)
\r
38 Received: by 10.96.77.105 with HTTP; Mon, 15 Dec 2014 12:46:40 -0800 (PST)
\r
39 In-Reply-To: <87iohc7iiz.fsf@maritornes.cs.unb.ca>
\r
40 References: <87k4q7s43v.fsf@ut.hh.sledj.net> <878w6gis5g.fsf@SSpaeth.de>
\r
41 <871v70ril7.fsf@yoom.home.cworth.org> <871v70z0y5.fsf@SSpaeth.de>
\r
42 <loom.20141215T121709-488@post.gmane.org>
\r
43 <87iohc7iiz.fsf@maritornes.cs.unb.ca>
\r
44 Date: Mon, 15 Dec 2014 21:46:40 +0100
\r
46 <CADHp1NyiuG-V2b68fsie_Fhn0kigUM88bPinhE9yZPCsWNW6QA@mail.gmail.com>
\r
47 Subject: Re: Python bindings and Xapian exceptions
\r
48 From: Matt <mattator@gmail.com>
\r
49 To: David Bremner <david@tethera.net>
\r
50 Content-Type: text/plain; charset=UTF-8
\r
51 X-Mailman-Approved-At: Tue, 16 Dec 2014 00:13:44 -0800
\r
52 Cc: notmuch@notmuchmail.org
\r
53 X-BeenThere: notmuch@notmuchmail.org
\r
54 X-Mailman-Version: 2.1.13
\r
56 List-Id: "Use and development of the notmuch mail system."
\r
57 <notmuch.notmuchmail.org>
\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
61 List-Post: <mailto:notmuch@notmuchmail.org>
\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
65 X-List-Received-Date: Mon, 15 Dec 2014 20:46:44 -0000
\r
67 2014-12-15 21:41 GMT+01:00 David Bremner <david@tethera.net>:
\r
68 > Matt <mattator@gmail.com> writes:
\r
70 >>> > But for exceptions in general, yes the notmuch library does need to be
\r
71 >>> > fixed to allow the caller of functions to distinguish between things
\r
72 >>> > like "no matches found" and "an exception occurred, so it's unknown if
\r
73 >>> > any messages match the search". That's a general class of library
\r
74 >>> > interface bugs that all need to be fixed.
\r
76 >> I 've also hit this *API bug* and was wondering if a fix had been done since
\r
77 >> then (I use notmuch 0.17) ? I found nothing on http://notmuchmail.org/news/
\r
79 > Can you be more specific? I'd say in general no thorough overhaul of
\r
80 > error handling has happened, but if you can tell us what particular
\r
81 > libnotmuch function (or the equivalient python binding) you are having
\r
82 > trouble with, we may be able to give a more informative answer.
\r
85 For instance when using the python bindings:
\r
87 self.db = notmuch.Database(self.db_path)
\r
88 and there I have a method called periodically that returns:
\r
89 returns notmuch.Query(self.db, "tag:unread and tag:inbox").count_messages()
\r
91 When it fails the previous method returns 0 and displays on stdout/stderr;
\r
92 "A Xapian exception occurred: The revision being read has been
\r
93 discarded - you should call Xapian::Database::reopen() and retry the
\r
95 Query string was: tag:unread and tag:inbox"
\r
97 The way for me to detect an error is to redirect stdout and check if
\r
98 the method outputted to stdout, which is not practical. I wish it
\r
99 would either return "-1", throw an exception or return 2 numbers like
\r
100 "errorcode, returned value". I personnally don't care if it's done at
\r
101 the library level or in the python bindings.
\r