From 5da4e321c0baf3575c10746c708a09f8231223c2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 18 Mar 2016 18:46:43 +0100 Subject: [PATCH] Stats: catch exceptions --- src/Stats.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Stats.cxx b/src/Stats.cxx index dbebaffe8..4bf69f643 100644 --- a/src/Stats.cxx +++ b/src/Stats.cxx @@ -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; }