]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- improved error handling
authorArvin Schnell <aschnell@suse.de>
Fri, 9 Apr 2021 13:24:17 +0000 (15:24 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 9 Apr 2021 13:24:17 +0000 (15:24 +0200)
client/errors.cc
package/snapper.changes
server/Client.cc
server/snapperd.cc

index 1b630ea7315bf368c686a6bd8707dd535485950e..a38b85d098d87c46a9293175c6930de3ba605a09 100644 (file)
@@ -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());
 
index f20f4d373e6618004760445dca2d1ca0164f6c23..b207c3db9196d732b265f18f65d308cf8b659739 100644 (file)
@@ -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
 
index 64a911573269c43a6009ed0bbced02cba28da79e..9275931176551b7edf3b9c53fbdc0af8ec855c0a 100644 (file)
@@ -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);
index bf039a26187019f652c6d71d4143e61e516d7a40..cd19230e947a78b4414fa73031efecf507acb5bc 100644 (file)
@@ -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");