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 67B5B4196F2 for ; Mon, 26 Apr 2010 02:28:18 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham 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 WtFN+E2MW8dg for ; Mon, 26 Apr 2010 02:28:17 -0700 (PDT) Received: from homiemail-a13.g.dreamhost.com (caiajhbdcaib.dreamhost.com [208.97.132.81]) by olra.theworths.org (Postfix) with ESMTP id 7794C431FC1 for ; Mon, 26 Apr 2010 02:28:17 -0700 (PDT) Received: from sspaeth.de (mtec-hg-docking-1-dhcp-204.ethz.ch [129.132.133.204]) (Authenticated sender: sebastian@sspaeth.de) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTPA id 87C0F6A806B; Mon, 26 Apr 2010 02:28:10 -0700 (PDT) Received: by sspaeth.de (sSMTP sendmail emulation); Mon, 26 Apr 2010 11:28:08 +0200 From: "Sebastian Spaeth" To: Carl Worth , Notmuch development list Subject: Re: Unhandled Xapian exception In-Reply-To: <87bpd8or04.fsf@yoom.home.cworth.org> References: <87aasul8h7.fsf@SSpaeth.de> <87bpd8or04.fsf@yoom.home.cworth.org> User-Agent: Notmuch/0.2-200-g455031c (http://notmuchmail.org) Emacs/23.1.1 (x86_64-pc-linux-gnu) Date: Mon, 26 Apr 2010 11:28:07 +0200 Message-ID: <87y6ga1s2g.fsf@SSpaeth.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 Apr 2010 09:28:18 -0000 On 2010-04-24, Carl Worth wrote: > On Fri, 23 Apr 2010 13:21:56 +0200, "Sebastian Spaeth" wrote: > > I propose to try..catch this code block and rather than returning VOID > > it could return NOTMUCH_STATUS_SUCCESS or NOTMUCH_XAPIAN_EXCEPTION. > > Not sure how "notmuch_database_find_message" would notify the caller of > > such an exception situation though. The only possible failure value is > > NULL (which also means did not find such a message). > And to support that, we would need a different scheme in the > library. Basically to just document that all calls might throw an > exception and then not catch and print anything. That would at least be > much simpler in the library. Then the top-level "notmuch" application > could just have a C++ wrapper for main() that would catch and print the > exception message. I think the python API would not be able to catch a C++ exception at the library level. I think the proper fix would be to guard the high level lib/* functions (our public API) and modify the API as needed to notify us. E.g for msg* = notmuch_database_find_message(id) (which I used to test the existence of a message and where NULL can now also mean that someone modified the database and which renders that test somewhat useless), I would propose that we make it: NOTMUCH_STATUS status = notmuch_database_find_message(id, msg*) where *msg will be filled with the message if it exists and xapian exceptions are notified through the status code. Does this make sense? Sebastian