lib/message: catch exception in n_m_get_thread_id
authorDavid Bremner <david@tethera.net>
Tue, 30 Jun 2020 01:14:11 +0000 (22:14 -0300)
committerDavid Bremner <david@tethera.net>
Sat, 4 Jul 2020 00:04:43 +0000 (21:04 -0300)
This allows us to return an error value from the library.

lib/message.cc
test/T560-lib-error.sh

index b7a64b1c3894c26224e78be165bf58ac445fa777..3ca7b902ef304e609e511ef3ce9fcb86c6338fb9 100644 (file)
@@ -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);
index b5600851640d980e8c29ee644dc955e682cef37d..815005365fd5c636dd6a3e3b6ff8b55f21cd6fc3 100755 (executable)
@@ -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;