lib/message: catch exception in n_m_get_thread_id

This allows us to return an error value from the library.
This commit is contained in:
David Bremner 2020-06-29 22:14:11 -03:00
parent bb51f3aa29
commit dbdb860bb9
2 changed files with 6 additions and 2 deletions

View 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)
{
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);

View file

@ -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;