mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
lib: catch Xapian exceptions in n_m_remove_tag
The churn here is again mainly re-indentation.
This commit is contained in:
parent
0fc769aa4f
commit
aa8e3f4487
2 changed files with 19 additions and 15 deletions
|
@ -1623,25 +1623,30 @@ notmuch_message_remove_tag (notmuch_message_t *message, const char *tag)
|
||||||
notmuch_private_status_t private_status;
|
notmuch_private_status_t private_status;
|
||||||
notmuch_status_t status;
|
notmuch_status_t status;
|
||||||
|
|
||||||
status = _notmuch_database_ensure_writable (message->notmuch);
|
try {
|
||||||
if (status)
|
status = _notmuch_database_ensure_writable (message->notmuch);
|
||||||
return status;
|
if (status)
|
||||||
|
return status;
|
||||||
|
|
||||||
if (tag == NULL)
|
if (tag == NULL)
|
||||||
return NOTMUCH_STATUS_NULL_POINTER;
|
return NOTMUCH_STATUS_NULL_POINTER;
|
||||||
|
|
||||||
if (strlen (tag) > NOTMUCH_TAG_MAX)
|
if (strlen (tag) > NOTMUCH_TAG_MAX)
|
||||||
return NOTMUCH_STATUS_TAG_TOO_LONG;
|
return NOTMUCH_STATUS_TAG_TOO_LONG;
|
||||||
|
|
||||||
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",
|
INTERNAL_ERROR ("_notmuch_message_remove_term return unexpected value: %d\n",
|
||||||
private_status);
|
private_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! message->frozen)
|
||||||
|
_notmuch_message_sync (message);
|
||||||
|
} catch (Xapian::Error &error) {
|
||||||
|
LOG_XAPIAN_EXCEPTION (message, error);
|
||||||
|
return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! message->frozen)
|
|
||||||
_notmuch_message_sync (message);
|
|
||||||
|
|
||||||
return NOTMUCH_STATUS_SUCCESS;
|
return NOTMUCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -519,7 +519,6 @@ EOF
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "Handle removing tag with closed database"
|
test_begin_subtest "Handle removing tag with closed database"
|
||||||
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