From: David Bremner <david@tethera.net>
Date: Sun, 5 Jul 2020 13:00:26 +0000 (-0300)
Subject: lib: use COERCE_STATUS in n_m_{add,remove}_tag
X-Git-Tag: 0.31_rc0~138
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=78e9b3467d9f09228a444bb2eec93e4c765b7e9b;p=notmuch

lib: use COERCE_STATUS in n_m_{add,remove}_tag

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.
---

diff --git a/lib/message.cc b/lib/message.cc
index e4848f83..5ea5aa22 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -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)