]> git.notmuchmail.org Git - notmuch/commitdiff
lib: use COERCE_STATUS in n_m_{add,remove}_tag
authorDavid Bremner <david@tethera.net>
Sun, 5 Jul 2020 13:00:26 +0000 (10:00 -0300)
committerDavid Bremner <david@tethera.net>
Tue, 14 Jul 2020 10:31:45 +0000 (07:31 -0300)
Currently I don't know of a good way of testing this, but at least in
principle a Xapian exception in _notmuch_message_{add,remove}_term
would cause an abort in the library.

lib/message.cc

index e4848f836a95d3ff320049569b86286bc74b5633..5ea5aa22214c7900d105b9fca1ea47d5550b91e3 100644 (file)
@@ -1602,8 +1602,9 @@ notmuch_message_add_tag (notmuch_message_t *message, const char *tag)
 
        private_status = _notmuch_message_add_term (message, "tag", tag);
        if (private_status) {
-           INTERNAL_ERROR ("_notmuch_message_add_term return unexpected value: %d\n",
-                           private_status);
+           return COERCE_STATUS (private_status,
+                                 "_notmuch_message_remove_term return unexpected value: %d\n",
+                                 private_status);
        }
 
        if (! message->frozen)
@@ -1636,8 +1637,9 @@ notmuch_message_remove_tag (notmuch_message_t *message, const char *tag)
 
        private_status = _notmuch_message_remove_term (message, "tag", tag);
        if (private_status) {
-           INTERNAL_ERROR ("_notmuch_message_remove_term return unexpected value: %d\n",
-                           private_status);
+           return COERCE_STATUS (private_status,
+                                 "_notmuch_message_remove_term return unexpected value: %d\n",
+                                 private_status);
        }
 
        if (! message->frozen)