diff options
| author | David Bremner <david@tethera.net> | 2020-06-29 22:14:11 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2020-07-03 21:04:43 -0300 |
| commit | dbdb860bb92b5eef0eadc6ffd1fd6d5bf64553b9 (patch) | |
| tree | eab7927e021223ff5211a789011ca3b971f6f513 | |
| parent | bb51f3aa29af43fe52e4545b83f8af80ae4e3712 (diff) | |
lib/message: catch exception in n_m_get_thread_id
This allows us to return an error value from the library.
| -rw-r--r-- | lib/message.cc | 7 | ||||
| -rwxr-xr-x | 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; |
