[PATCH 11/11] lib: use COERCE_STATUS in n_m_{add,remove}_tag

Subject: [PATCH 11/11] lib: use COERCE_STATUS in n_m_{add,remove}_tag

Date: Sun, 5 Jul 2020 10:00:26 -0300

To: notmuch@notmuchmail.org

Cc: David Bremner

From: David Bremner


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 | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/message.cc b/lib/message.cc
index e4463d05..4e1be986 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1627,8 +1627,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)
@@ -1661,8 +1662,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)
-- 
2.27.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: