mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-23 01:44:52 +01:00
lib: catch Xapian exceptions in n_m_add_tag
This is mostly just (horizontal) code movement due to wrapping everything in a try / catch.
This commit is contained in:
parent
503c035077
commit
33dd5fdc69
2 changed files with 20 additions and 15 deletions
|
@ -1589,6 +1589,7 @@ notmuch_message_add_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;
|
||||||
|
|
||||||
|
try {
|
||||||
status = _notmuch_database_ensure_writable (message->notmuch);
|
status = _notmuch_database_ensure_writable (message->notmuch);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
@ -1608,6 +1609,11 @@ notmuch_message_add_tag (notmuch_message_t *message, const char *tag)
|
||||||
if (! message->frozen)
|
if (! message->frozen)
|
||||||
_notmuch_message_sync (message);
|
_notmuch_message_sync (message);
|
||||||
|
|
||||||
|
} catch (Xapian::Error &error) {
|
||||||
|
LOG_XAPIAN_EXCEPTION (message, error);
|
||||||
|
return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
|
||||||
|
}
|
||||||
|
|
||||||
return NOTMUCH_STATUS_SUCCESS;
|
return NOTMUCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -503,7 +503,6 @@ EOF
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "Handle adding tag with closed database"
|
test_begin_subtest "Handle adding 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