aboutsummaryrefslogtreecommitdiff
path: root/lib/database.cc
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2025-08-06 07:43:06 +0200
committerDavid Bremner <david@tethera.net>2025-08-09 07:12:23 -0300
commitaa761727999b105711ba4ca789e0836a0a05cf9f (patch)
tree560091147ab6db4c6e1b0a6a34451f34963a7a03 /lib/database.cc
parentbee7a53194606757997f069f0e95ac862fbba0e0 (diff)
lib: return NOTMUCH_STATUS_OPERATION_INVALIDATED where appropriate
The overall goal is to allow clients to restart operations in situations where that is the response recommended by the underlying Xapian library. Amended-by: db, added above explanation
Diffstat (limited to 'lib/database.cc')
-rw-r--r--lib/database.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/database.cc b/lib/database.cc
index 8f687eee..eb7ed388 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -468,7 +468,7 @@ notmuch_database_find_message (notmuch_database_t *notmuch,
error.get_msg ().c_str ());
notmuch->exception_reported = true;
*message_ret = NULL;
- return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+ return _notmuch_xapian_error ();
}
}
@@ -520,7 +520,7 @@ notmuch_database_close (notmuch_database_t *notmuch)
* transaction, ALL pending changes will be discarded */
notmuch->xapian_db->close ();
} catch (const Xapian::Error &error) {
- status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+ status = _notmuch_xapian_error ();
if (! notmuch->exception_reported) {
_notmuch_database_log (notmuch,
"Error: A Xapian exception occurred closing database: %s\n",
@@ -689,7 +689,7 @@ notmuch_database_compact_db (notmuch_database_t *notmuch,
compactor);
} catch (const Xapian::Error &error) {
_notmuch_database_log (notmuch, "Error while compacting: %s\n", error.get_msg ().c_str ());
- ret = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+ ret = _notmuch_xapian_error ();
goto DONE;
}
@@ -1127,7 +1127,7 @@ notmuch_database_begin_atomic (notmuch_database_t *notmuch)
_notmuch_database_log (notmuch, "A Xapian exception occurred beginning transaction: %s.\n",
error.get_msg ().c_str ());
notmuch->exception_reported = true;
- return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+ return _notmuch_xapian_error ();
}
DONE:
@@ -1169,7 +1169,7 @@ notmuch_database_end_atomic (notmuch_database_t *notmuch)
_notmuch_database_log (notmuch, "A Xapian exception occurred committing transaction: %s.\n",
error.get_msg ().c_str ());
notmuch->exception_reported = true;
- return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+ return _notmuch_xapian_error ();
}
if (notmuch->atomic_dirty) {
@@ -1417,7 +1417,7 @@ notmuch_database_get_directory (notmuch_database_t *notmuch,
_notmuch_database_log (notmuch, "A Xapian exception occurred getting directory: %s.\n",
error.get_msg ().c_str ());
notmuch->exception_reported = true;
- status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+ status = _notmuch_xapian_error ();
}
return status;
}
@@ -1517,7 +1517,7 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
"Error: A Xapian exception occurred finding message by filename: %s\n",
error.get_msg ().c_str ());
notmuch->exception_reported = true;
- status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+ status = _notmuch_xapian_error ();
}
DONE: