lib: catch exceptions in n_m_get_filenames

This is essentially copied from the change to notmuch_message_get_filename
This commit is contained in:
David Bremner 2020-07-04 11:09:09 -03:00
parent 2c2ba7d6e2
commit 286161b703
3 changed files with 8 additions and 2 deletions

View file

@ -1143,7 +1143,12 @@ notmuch_message_get_filename (notmuch_message_t *message)
notmuch_filenames_t *
notmuch_message_get_filenames (notmuch_message_t *message)
{
_notmuch_message_ensure_filename_list (message);
try {
_notmuch_message_ensure_filename_list (message);
} catch (Xapian::Error &error) {
LOG_XAPIAN_EXCEPTION (message, error);
return NULL;
}
return _notmuch_filenames_create (message, message->filename_list);
}

View file

@ -1448,6 +1448,8 @@ notmuch_message_get_filename (notmuch_message_t *message);
*
* Each filename in the iterator is an absolute filename, (the initial
* component will match notmuch_database_get_path() ).
*
* This function returns NULL if it triggers a Xapian exception.
*/
notmuch_filenames_t *
notmuch_message_get_filenames (notmuch_message_t *message);

View file

@ -422,7 +422,6 @@ EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "Handle getting all message filenames from closed database"
test_subtest_known_broken
cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
{
notmuch_filenames_t *filenames;