unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Sebastian Spaeth <Sebastian@SSpaeth.de>
To: Carl Worth <cworth@cworth.org>, notmuch <notmuch@notmuchmail.org>
Subject: Re: Python bindings and Xapian exceptions
Date: Fri, 05 Nov 2010 08:25:38 +0100	[thread overview]
Message-ID: <871v70z0y5.fsf@SSpaeth.de> (raw)
In-Reply-To: <871v70ril7.fsf@yoom.home.cworth.org>

[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]

On Thu, 04 Nov 2010 12:31:48 -0700, Carl Worth <cworth@cworth.org> wrote:
> On Tue, 15 Jun 2010 11:03:55 +0200, "Sebastian Spaeth" wrote:
> > >   A Xapian exception occurred finding message: The revision being read
> > >   has been discarded - you should call Xapian::Database::reopen() and
> > >   retry the operation.
> > > It makes the Python bindings almost useless to me.

> > The proper fix, and a reason why I am not immediately hacking around in
> > the python bindings is that notmuch the library would actually return a
> > proper error value rather than print to stderr and quit.
> 
> For this particular case, I think the correct thing is for the library
> to simply do the reopen() itself.

That would already help a lot. But if there is for example a background
task running that modifies the database a lot, reopening once might
still not suffice. So we should try to reopen, yes. But if it still does
not work after a reopen, we still need the possibility to fail
gracefully while notifying the user about the failure.

> But for exceptions in general, yes the notmuch library does need to be
> fixed to allow the caller of functions to distinguish between things
> like "no matches found" and "an exception occurred, so it's unknown if
> any messages match the search". That's a general class of library
> interface bugs that all need to be fixed.

It does return a status for many operations already which is good. THere
are only a few cases where it does not and the only one I know off-hand
is find_message() which is useless at the moment as its result cannot be
trusted. 

What would probably also be good if notmuchlib could export a
database.reopen() command so bindings can reopen the database in case
they need to, without having to have xapian development headers
installed and linking to it directly. Of course if libnotmuch reopens
itself, that would not be required.

Sebastian

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2010-11-05  7:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10  8:07 Python bindings and Xapian exceptions David Edmondson
2010-06-15  9:03 ` Sebastian Spaeth
2010-06-15  9:17   ` David Edmondson
2010-11-04 19:31   ` Carl Worth
2010-11-05  7:25     ` Sebastian Spaeth [this message]
2014-12-15 11:19       ` Matt
2014-12-15 20:41         ` David Bremner
2014-12-15 20:46           ` Matt
2014-12-16  8:02             ` David Bremner
2014-12-18 21:10               ` Matt

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=871v70z0y5.fsf@SSpaeth.de \
    --to=sebastian@sspaeth.de \
    --cc=cworth@cworth.org \
    --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).