]> git.notmuchmail.org Git - notmuch/commitdiff
lib: catch exceptions in n_m_get_filenames
authorDavid Bremner <david@tethera.net>
Sat, 4 Jul 2020 14:09:09 +0000 (11:09 -0300)
committerDavid Bremner <david@tethera.net>
Mon, 13 Jul 2020 10:19:22 +0000 (07:19 -0300)
This is essentially copied from the change to notmuch_message_get_filename

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

index 1a9eaffe05e44bca5ba50f83484a2301ca81bd2e..8e43a393c55171b425175537298c0ff0fecb6c3b 100644 (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_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);
 }
 
     return _notmuch_filenames_create (message, message->filename_list);
 }
index 5c17ec7cbb3329e229021f04722c3c7c3cbba65e..e544aafd60b6b28e6dacee5671b3a87c7d31f830 100644 (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() ).
  *
  * 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);
  */
 notmuch_filenames_t *
 notmuch_message_get_filenames (notmuch_message_t *message);
index 8d9b4cc05b713f841a8eecf6f32682dae732fe64..ce3526a406b5f88e481bce2f76b01e38efe4bb06 100755 (executable)
@@ -422,7 +422,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Handle getting all message filenames from closed database"
 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;
 cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
     {
         notmuch_filenames_t *filenames;