Stats: catch exceptions

This commit is contained in:
Max Kellermann 2016-03-18 18:46:43 +01:00
parent e8519fecb4
commit 5da4e321c0

View File

@ -82,12 +82,19 @@ stats_update(const Database &db)
Error error;
const DatabaseSelection selection("", true);
if (db.GetStats(selection, stats, error)) {
stats_validity = StatsValidity::VALID;
return true;
} else {
LogError(error);
try {
if (db.GetStats(selection, stats, error)) {
stats_validity = StatsValidity::VALID;
return true;
} else {
LogError(error);
stats_validity = StatsValidity::FAILED;
return false;
}
} catch (const std::runtime_error &e) {
LogError(e);
stats_validity = StatsValidity::FAILED;
return false;
}