From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 0IK+Efoy+15CHwAA0tVLHw (envelope-from ) for ; Tue, 30 Jun 2020 12:41:30 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 6BS+Dfoy+17sHgAAB5/wlQ (envelope-from ) for ; Tue, 30 Jun 2020 12:41:30 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ACE839400BB for ; Tue, 30 Jun 2020 12:41:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id CE6EF6DE13E3; Tue, 30 Jun 2020 05:41:21 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tRvTdHmTq5Ow; Tue, 30 Jun 2020 05:41:21 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 8B0EB6DE137E; Tue, 30 Jun 2020 05:41:20 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id E2B4E6DE137E for ; Tue, 30 Jun 2020 05:41:18 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UC_FCw0RykUF for ; Tue, 30 Jun 2020 05:41:18 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTP id 0CB5B6DE102E for ; Tue, 30 Jun 2020 05:41:17 -0700 (PDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 94AC56141D; Tue, 30 Jun 2020 08:41:17 -0400 (EDT) Received: (nullmailer pid 2275252 invoked by uid 1000); Tue, 30 Jun 2020 12:41:15 -0000 Resent-To: notmuch@notmuchmail.org Resent-From: David Bremner Resent-Date: Tue, 30 Jun 2020 09:41:15 -0300 Resent-Message-ID: <87k0zoiv4k.fsf@tethera.net> From: David Bremner To: notmuch@notmuchmail.org Subject: introduce exception handling at top level of libnotmuch Date: Mon, 29 Jun 2020 22:14:07 -0300 Message-Id: <20200630011411.612552-1-david@tethera.net> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -0.01 X-TUID: wpdgrLaKPYkv I know that some of you are not C++ fans, but at the moment this is the cleanest fix I can think of to uncaught xapian exceptions causing calls to the library to die. Floris reminded me of this recently with the discussion about operations on closed databases, but cleaning up the handling of exceptions in libnotmuch has been on my mind for a while. It will be bit laborious so I did a few functions for discussion purposes before getting too carried away. There is still a certain amount of boilerplate with more or less identical try/catch blocks (yes, I really miss scheme macros here). I could mostly eliminate that with C++11 lambdas, but I wasn't sure the result was more maintainable or nicer. This is definitely targeted for post 0.30.