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 EEn+JP0w+177BgAA0tVLHw (envelope-from ) for ; Tue, 30 Jun 2020 12:33:01 +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 oOW9IP0w+17fGwAAB5/wlQ (envelope-from ) for ; Tue, 30 Jun 2020 12:33:01 +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 F120F94013C for ; Tue, 30 Jun 2020 12:33:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 6CB966DE0F76; Tue, 30 Jun 2020 05:32:59 -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 EdNhbEJtTLRo; Tue, 30 Jun 2020 05:32:58 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 5585D6DE0F88; Tue, 30 Jun 2020 05:32:58 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id E10E86DE0F88 for ; Tue, 30 Jun 2020 05:32:55 -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 WGoW0vpotDZd for ; Tue, 30 Jun 2020 05:32:55 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTP id EC2646DE0F76 for ; Tue, 30 Jun 2020 05:32:54 -0700 (PDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id A679A6141D; Tue, 30 Jun 2020 08:32:54 -0400 (EDT) Received: (nullmailer pid 2275062 invoked by uid 1000); Tue, 30 Jun 2020 12:32:53 -0000 Resent-To: notmuch@notmuchmail.org Resent-From: David Bremner Resent-Date: Tue, 30 Jun 2020 09:32:53 -0300 Resent-Message-ID: <87sgecivii.fsf@tethera.net> Received: by fethera.tethera.net (Postfix, from userid 1001) id 8E2196142F; Mon, 29 Jun 2020 21:14:34 -0400 (EDT) Received: (nullmailer pid 612646 invoked by uid 1000); Tue, 30 Jun 2020 01:14:18 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 4/4] lib/message: catch exception in n_m_get_thread_id Date: Mon, 29 Jun 2020 22:14:11 -0300 Message-Id: <20200630011411.612552-5-david@tethera.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200630011411.612552-1-david@tethera.net> References: <20200630011411.612552-1-david@tethera.net> 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: YVK9l+3Rr9qV This allows us to return an error value from the library. --- lib/message.cc | 7 ++++++- test/T560-lib-error.sh | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index b7a64b1c..3ca7b902 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -604,7 +604,12 @@ _notmuch_message_get_in_reply_to (notmuch_message_t *message) const char * notmuch_message_get_thread_id (notmuch_message_t *message) { - _notmuch_message_ensure_metadata (message, message->thread_id); + try { + _notmuch_message_ensure_metadata (message, message->thread_id); + } catch (Xapian::Error &error) { + LOG_XAPIAN_EXCEPTION (message, error); + return NULL; + } if (! message->thread_id) INTERNAL_ERROR ("Message with document ID of %u has no thread ID.\n", message->doc_id); diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index b5600851..81500536 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -360,7 +360,6 @@ test_expect_equal_file EXPECTED OUTPUT backup_database test_begin_subtest "Handle getting thread-id from closed database" -test_subtest_known_broken cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR} { const char *id2; -- 2.27.0