[gnome-shell] extensions-tool: Log existing errors
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] extensions-tool: Log existing errors
- Date: Sun, 5 Apr 2020 12:40:29 +0000 (UTC)
commit 23e382dd33f2960f1dea22a725b0c6375ea6602f
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Mar 14 11:00:49 2020 +0100
extensions-tool: Log existing errors
In many cases we currently only indicate failure in the return value,
which is easily missed. Print some meaningful errors instead.
https://gitlab.gnome.org/GNOME/gnome-shell/issues/2391
subprojects/extensions-tool/src/command-info.c | 10 ++++++++--
subprojects/extensions-tool/src/command-list.c | 5 ++++-
subprojects/extensions-tool/src/command-prefs.c | 15 ++++++++++++---
subprojects/extensions-tool/src/command-uninstall.c | 8 +++++++-
4 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/subprojects/extensions-tool/src/command-info.c b/subprojects/extensions-tool/src/command-info.c
index e280023e1c..61492a5d3a 100644
--- a/subprojects/extensions-tool/src/command-info.c
+++ b/subprojects/extensions-tool/src/command-info.c
@@ -46,13 +46,19 @@ show_extension_info (const char *uuid)
NULL,
&error);
if (response == NULL)
- return FALSE;
+ {
+ g_printerr (_("Failed to connect to GNOME Shell\n"));
+ return FALSE;
+ }
asv = g_variant_get_child_value (response, 0);
info = g_variant_dict_new (asv);
if (!g_variant_dict_contains (info, "uuid"))
- return FALSE;
+ {
+ g_printerr (_("Extension “%s” doesn't exist\n"), uuid);
+ return FALSE;
+ }
print_extension_info (info, DISPLAY_DETAILED);
diff --git a/subprojects/extensions-tool/src/command-list.c b/subprojects/extensions-tool/src/command-list.c
index bc021fd14e..62db4d9d3e 100644
--- a/subprojects/extensions-tool/src/command-list.c
+++ b/subprojects/extensions-tool/src/command-list.c
@@ -60,7 +60,10 @@ list_extensions (ListFilterFlags filter, DisplayFormat format)
NULL,
&error);
if (response == NULL)
- return FALSE;
+ {
+ g_printerr (_("Failed to connect to GNOME Shell\n"));
+ return FALSE;
+ }
extensions = g_variant_get_child_value (response, 0);
diff --git a/subprojects/extensions-tool/src/command-prefs.c b/subprojects/extensions-tool/src/command-prefs.c
index 86799eafc5..25d1626c4d 100644
--- a/subprojects/extensions-tool/src/command-prefs.c
+++ b/subprojects/extensions-tool/src/command-prefs.c
@@ -47,17 +47,26 @@ launch_extension_prefs (const char *uuid)
NULL,
&error);
if (response == NULL)
- return FALSE;
+ {
+ g_printerr (_("Failed to connect to GNOME Shell"));
+ return FALSE;
+ }
asv = g_variant_get_child_value (response, 0);
info = g_variant_dict_new (asv);
if (!g_variant_dict_contains (info, "uuid"))
- return FALSE;
+ {
+ g_printerr (_("Extension “%s” doesn't exist\n"), uuid);
+ return FALSE;
+ }
g_variant_dict_lookup (info, "hasPrefs", "b", &has_prefs);
if (!has_prefs)
- return FALSE;
+ {
+ g_printerr (_("Extension “%s” doesn't have preferences\n"), uuid);
+ return FALSE;
+ }
g_dbus_proxy_call_sync (proxy,
"OpenExtensionPrefs",
diff --git a/subprojects/extensions-tool/src/command-uninstall.c
b/subprojects/extensions-tool/src/command-uninstall.c
index 5974e098e1..4b902f4037 100644
--- a/subprojects/extensions-tool/src/command-uninstall.c
+++ b/subprojects/extensions-tool/src/command-uninstall.c
@@ -45,10 +45,16 @@ uninstall_extension (const char *uuid)
NULL,
&error);
if (response == NULL)
- return FALSE;
+ {
+ g_printerr (_("Failed to connect to GNOME Shell"));
+ return FALSE;
+ }
g_variant_get (response, "(b)", &success);
+ if (!success)
+ g_printerr (_("Failed to uninstall “%s”\n"), uuid);
+
return success;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]