Python bindings and Xapian exceptions

David Edmondson dme at dme.org
Tue Jun 15 02:17:25 PDT 2010


On Tue, 15 Jun 2010 11:03:55 +0200, "Sebastian Spaeth" <Sebastian at SSpaeth.de> 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.
> 
> Not sure, if the python bindings should simply drop and reopen a
> database connection in that case? But I am not sure if libnotmuch.so
> still simply exits on such an error case.
> 
> 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.
> 
> Happy to receive suggestions on how to handle this best from the python
> side of things.

Unfortunately I'm an ignorant about the best solution.

Having the Python layer hide the fact that the database was re-opened
seems as though it might be dangerous (in case I mix state from before
and after the re-opening), but I can't give a concrete example of
something that would fail.

Given that exception based programming is common in Python, simple
raising the exception and allowing the application to handle it appears
to make sense.

dme.
-- 
David Edmondson, http://dme.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100615/4aaf9188/attachment.pgp>


More information about the notmuch mailing list