mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
lib: handle xapian exception in n_m_remove_all_tags
At least the exception we already catch should be reported properly.
This commit is contained in:
parent
a4ac9941a8
commit
a2b90dc084
3 changed files with 11 additions and 6 deletions
|
@ -2071,15 +2071,19 @@ notmuch_message_remove_all_tags (notmuch_message_t *message)
|
||||||
status = _notmuch_database_ensure_writable (message->notmuch);
|
status = _notmuch_database_ensure_writable (message->notmuch);
|
||||||
if (status)
|
if (status)
|
||||||
return 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_valid (tags);
|
||||||
notmuch_tags_move_to_next (tags)) {
|
notmuch_tags_move_to_next (tags)) {
|
||||||
tag = notmuch_tags_get (tags);
|
tag = notmuch_tags_get (tags);
|
||||||
|
|
||||||
private_status = _notmuch_message_remove_term (message, "tag", tag);
|
private_status = _notmuch_message_remove_term (message, "tag", tag);
|
||||||
if (private_status) {
|
if (private_status) {
|
||||||
INTERNAL_ERROR ("_notmuch_message_remove_term return unexpected value: %d\n",
|
return COERCE_STATUS (private_status,
|
||||||
|
"_notmuch_message_remove_term return unexpected value: %d\n",
|
||||||
private_status);
|
private_status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* See notmuch_message_freeze for an example showing how to safely
|
||||||
* replace tag values.
|
* replace tag values.
|
||||||
*
|
*
|
||||||
* NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
|
* @retval #NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in
|
||||||
* mode so message cannot be modified.
|
* read-only mode so message cannot be modified.
|
||||||
|
* @retval #NOTMUCH_STATUS_XAPIAN_EXCEPTION: an execption was thrown
|
||||||
|
* accessing the database.
|
||||||
*/
|
*/
|
||||||
notmuch_status_t
|
notmuch_status_t
|
||||||
notmuch_message_remove_all_tags (notmuch_message_t *message);
|
notmuch_message_remove_all_tags (notmuch_message_t *message);
|
||||||
|
|
|
@ -583,7 +583,6 @@ EOF
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "Handle removing all tags with closed db"
|
test_begin_subtest "Handle removing all tags with closed db"
|
||||||
test_subtest_known_broken
|
|
||||||
cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
|
cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
|
||||||
{
|
{
|
||||||
notmuch_status_t status;
|
notmuch_status_t status;
|
||||||
|
|
Loading…
Reference in a new issue