[PATCH 4/4] lib/message: catch exception in n_m_get_thread_id
David Bremner
david at tethera.net
Mon Jun 29 18:14:11 PDT 2020
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
More information about the notmuch
mailing list