[gnome-software/gnome-3-38: 3/4] fwupd: Do not propagate 'not supported' error on updates check




commit 3b29e3d48ac9fb46cb98fb0f3e827385051dcfbf
Author: Milan Crha <mcrha redhat com>
Date:   Wed Dec 9 13:30:47 2020 +0100

    fwupd: Do not propagate 'not supported' error on updates check
    
    This change avoids two error messages in the GUI on available updates refresh:
    
       Unable to get list of updates: The name is not activatable
    
    and
    
       Sorry, something went wrong: The name is not activatable
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1104

 plugins/fwupd/gs-plugin-fwupd.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
index 3775b8a4c..d032640b1 100644
--- a/plugins/fwupd/gs-plugin-fwupd.c
+++ b/plugins/fwupd/gs-plugin-fwupd.c
@@ -546,10 +546,10 @@ gs_plugin_add_updates (GsPlugin *plugin,
        /* get current list of updates */
        devices = fwupd_client_get_devices (priv->client, cancellable, &error_local);
        if (devices == NULL) {
-               if (g_error_matches (error_local,
-                                    FWUPD_ERROR,
-                                    FWUPD_ERROR_NOTHING_TO_DO)) {
-                       g_debug ("no devices");
+               if (g_error_matches (error_local, FWUPD_ERROR, FWUPD_ERROR_NOTHING_TO_DO) ||
+                   g_error_matches (error_local, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED) ||
+                   g_error_matches (error_local, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND)) {
+                       g_debug ("no devices (%s)", error_local->message);
                        return TRUE;
                }
                g_propagate_error (error, g_steal_pointer (&error_local));
@@ -757,11 +757,18 @@ gs_plugin_refresh (GsPlugin *plugin,
                   GError **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
+       g_autoptr(GError) error_local = NULL;
        g_autoptr(GPtrArray) remotes = NULL;
 
        /* get the list of enabled remotes */
-       remotes = fwupd_client_get_remotes (priv->client, cancellable, error);
+       remotes = fwupd_client_get_remotes (priv->client, cancellable, &error_local);
        if (remotes == NULL) {
+               g_debug ("No remotes found: %s", error_local ? error_local->message : "Unknown error");
+               if (g_error_matches (error_local, FWUPD_ERROR, FWUPD_ERROR_NOTHING_TO_DO) ||
+                   g_error_matches (error_local, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED) ||
+                   g_error_matches (error_local, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND))
+                       return TRUE;
+               g_propagate_error (error, g_steal_pointer (&error_local));
                gs_plugin_fwupd_error_convert (error);
                return FALSE;
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]