diff options
| author | David Bremner <david@tethera.net> | 2020-07-08 21:17:04 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2020-07-20 08:54:42 -0300 |
| commit | a2b90dc084c0224e56c1e63773048545788c7ad4 (patch) | |
| tree | 6150ac8fce63e1935836c2d74788cd0ba91a8715 /lib | |
| parent | a4ac9941a8f3afde7d2ffa17a6862e63444affa9 (diff) | |
lib: handle xapian exception in n_m_remove_all_tags
At least the exception we already catch should be reported properly.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/message.cc | 10 | ||||
| -rw-r--r-- | lib/notmuch.h | 6 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/message.cc b/lib/message.cc index 8e090aa3..09708ed9 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -2071,16 +2071,20 @@ notmuch_message_remove_all_tags (notmuch_message_t *message) status = _notmuch_database_ensure_writable (message->notmuch); if (status) return status; + tags = notmuch_message_get_tags (message); + if (! tags) + return NOTMUCH_STATUS_XAPIAN_EXCEPTION; - for (tags = notmuch_message_get_tags (message); + for (; notmuch_tags_valid (tags); notmuch_tags_move_to_next (tags)) { tag = notmuch_tags_get (tags); 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); } } diff --git a/lib/notmuch.h b/lib/notmuch.h index edad3d8a..82d6c10f 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -1635,8 +1635,10 @@ notmuch_message_remove_tag (notmuch_message_t *message, const char *tag); * See notmuch_message_freeze for an example showing how to safely * replace tag values. * - * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only - * mode so message cannot be modified. + * @retval #NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in + * read-only mode so message cannot be modified. + * @retval #NOTMUCH_STATUS_XAPIAN_EXCEPTION: an execption was thrown + * accessing the database. */ notmuch_status_t notmuch_message_remove_all_tags (notmuch_message_t *message); |
