[gnome-software/1910-software-fails-to-show-unhandled-error-from-fwupd] gs-shell: Change which errors are ignored for refresh and update non-interactive actions



commit bcbddd6d86ae1fb3b73b8711617c19ea39c50340
Author: Milan Crha <mcrha redhat com>
Date:   Fri Sep 30 12:20:05 2022 +0200

    gs-shell: Change which errors are ignored for refresh and update non-interactive actions
    
    Background refresh/update can fails with various errors, some might be important to the user
    even for non-interactive updates, thus make such errors shown in the GUI.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1910

 src/gs-shell.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index cb730fca1..2ecc14f70 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1261,10 +1261,7 @@ gs_shell_show_event_refresh (GsShell *shell, GsPluginEvent *event)
        GsPluginAction action = gs_plugin_event_get_action (event);
        g_autofree gchar *str_origin = NULL;
        g_autoptr(GString) str = g_string_new (NULL);
-
-       /* ignore any errors from background downloads */
-       if (!gs_plugin_event_has_flag (event, GS_PLUGIN_EVENT_FLAG_INTERACTIVE))
-               return TRUE;
+       gboolean can_ignore_error = TRUE;
 
        if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_DOWNLOAD_FAILED)) {
                if (origin != NULL) {
@@ -1331,8 +1328,13 @@ gs_shell_show_event_refresh (GsShell *shell, GsPluginEvent *event)
                        g_string_append (str, _("Unable to get list of updates"));
                }
                gs_shell_append_detailed_error (shell, str, error);
+               can_ignore_error = FALSE;
        }
 
+       /* ignore any errors from background downloads */
+       if (can_ignore_error && !gs_plugin_event_has_flag (event, GS_PLUGIN_EVENT_FLAG_INTERACTIVE))
+               return TRUE;
+
        if (str->len == 0)
                return FALSE;
 
@@ -1481,10 +1483,7 @@ gs_shell_show_event_update (GsShell *shell, GsPluginEvent *event)
        g_autofree gchar *str_app = NULL;
        g_autofree gchar *str_origin = NULL;
        g_autoptr(GString) str = g_string_new (NULL);
-
-       /* ignore any errors from background downloads */
-       if (!gs_plugin_event_has_flag (event, GS_PLUGIN_EVENT_FLAG_INTERACTIVE))
-               return TRUE;
+       gboolean can_ignore_error = TRUE;
 
        if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_DOWNLOAD_FAILED)) {
                if (app != NULL && origin != NULL) {
@@ -1618,8 +1617,13 @@ gs_shell_show_event_update (GsShell *shell, GsPluginEvent *event)
                        g_string_append_printf (str, _("Unable to install updates"));
                }
                gs_shell_append_detailed_error (shell, str, error);
+               can_ignore_error = FALSE;
        }
 
+       /* ignore any errors from background downloads */
+       if (can_ignore_error && !gs_plugin_event_has_flag (event, GS_PLUGIN_EVENT_FLAG_INTERACTIVE))
+               return TRUE;
+
        if (str->len == 0)
                return FALSE;
 


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