From: Arvin Schnell Date: Fri, 9 Apr 2021 13:24:17 +0000 (+0200) Subject: - improved error handling X-Git-Tag: v0.9.0~4^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=158edb2dac734e7ec188a83ae8826c3f73fbb9fa;p=thirdparty%2Fsnapper.git - improved error handling --- diff --git a/client/errors.cc b/client/errors.cc index 1b630ea7..a38b85d0 100644 --- a/client/errors.cc +++ b/client/errors.cc @@ -1,6 +1,6 @@ /* * Copyright (c) [2011-2014] Novell, Inc. - * Copyright (c) [2016,2018] SUSE LLC + * Copyright (c) [2016-2021] SUSE LLC * * All Rights Reserved. * @@ -86,6 +86,9 @@ error_description(const DBus::ErrorException& e) if (name == "error.io_error") return sformat(_("IO Error (%s)."), e.message()); + if (name == "error.list_configs_failed") + return sformat(_("Listing configs failed (%s)."), e.message()); + if (name == "error.create_config_failed") return sformat(_("Creating config failed (%s)."), e.message()); diff --git a/package/snapper.changes b/package/snapper.changes index f20f4d37..b207c3db 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Apr 09 15:23:14 CEST 2021 - aschnell@suse.com + +- improved error handling (see gh#openSUSE/snapper#626) + ------------------------------------------------------------------- Thu Apr 08 14:05:19 CEST 2021 - aschnell@suse.com diff --git a/server/Client.cc b/server/Client.cc index 64a91157..92759311 100644 --- a/server/Client.cc +++ b/server/Client.cc @@ -1,6 +1,6 @@ /* * Copyright (c) [2012-2015] Novell, Inc. - * Copyright (c) [2016,2018] SUSE LLC + * Copyright (c) [2016-2021] SUSE LLC * * All Rights Reserved. * @@ -1741,6 +1741,12 @@ Client::dispatch(DBus::Connection& conn, DBus::Message& msg) DBus::MessageError reply(msg, "error.unknown_config", DBUS_ERROR_FAILED); conn.send(reply); } + catch (const ListConfigsFailedException& e) + { + SN_CAUGHT(e); + DBus::MessageError reply(msg, "error.list_configs_failed", e.what()); + conn.send(reply); + } catch (const CreateConfigFailedException& e) { SN_CAUGHT(e); diff --git a/server/snapperd.cc b/server/snapperd.cc index bf039a26..cd19230e 100644 --- a/server/snapperd.cc +++ b/server/snapperd.cc @@ -1,6 +1,6 @@ /* * Copyright (c) [2012-2015] Novell, Inc. - * Copyright (c) 2018 SUSE LLC + * Copyright (c) [2018-2021] SUSE LLC * * All Rights Reserved. * @@ -279,7 +279,16 @@ main(int argc, char** argv) y2mil("Loading snapper configs"); - meta_snappers.init(); + try + { + meta_snappers.init(); + } + catch (const Exception& e) + { + SN_CAUGHT(e); + + y2err("failed to load snapper configs"); + } y2mil("Listening for method calls and signals");