+
+/* Should be called from a Xapian::Error exception handler to map it
+ * into a notmuch status code. */
+static inline notmuch_private_status_t
+_notmuch_xapian_error_private (void)
+{
+ try {
+ throw;
+ } catch (const Xapian::DatabaseModifiedError& _e) {
+ return NOTMUCH_PRIVATE_STATUS_OPERATION_INVALIDATED;
+ } catch (const Xapian::Error& _e) {
+ return NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION;
+ }
+}
+
+static inline notmuch_status_t
+_notmuch_xapian_error (void)
+{
+ return COERCE_STATUS (_notmuch_xapian_error_private (),
+ "mapping Xapian exception");
+}