lib: improve store error messages

Use xapian_try_result
This commit is contained in:
Dirk-Jan C. Binnema
2023-07-23 21:03:02 +03:00
parent d374d94031
commit 72f43f11df
2 changed files with 8 additions and 21 deletions

View File

@ -76,6 +76,8 @@ template <typename Func> auto
xapian_try_result(Func&& func) noexcept -> std::decay_t<decltype(func())>
try {
return func();
} catch (const Xapian::DatabaseLockError& dlerr) {
return Err(Error::Code::StoreLock, "database locked");
} catch (const Xapian::Error& xerr) {
return Err(Error::Code::Xapian, "{}", xerr.get_error_string());
} catch (const std::runtime_error& re) {