[gnome-software] trivial: Always return plugin errors with the correct domain



commit 12f526585d3deaa44326f21bc58a2009baf45d4d
Author: Richard Hughes <richard hughsie com>
Date:   Fri Dec 12 14:13:33 2014 +0000

    trivial: Always return plugin errors with the correct domain
    
    Also, don't use g_propagate_error() when using _cleanup_error_free_.

 src/plugins/gs-plugin-packagekit-history.c |    8 +++++---
 src/plugins/gs-plugin-systemd-updates.c    |    7 +++++--
 2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-history.c b/src/plugins/gs-plugin-packagekit-history.c
index d70df2a..cfc29cc 100644
--- a/src/plugins/gs-plugin-packagekit-history.c
+++ b/src/plugins/gs-plugin-packagekit-history.c
@@ -189,7 +189,6 @@ gs_plugin_packagekit_refine (GsPlugin *plugin,
                                     G_DBUS_ERROR_UNKNOWN_METHOD)) {
                        g_debug ("No history available as PackageKit is too old: %s",
                                 error_local->message);
-                       g_error_free (error_local);
 
                        /* just set this to something non-zero so we don't keep
                         * trying to call GetPackageHistory */
@@ -202,13 +201,16 @@ gs_plugin_packagekit_refine (GsPlugin *plugin,
                                            G_IO_ERROR_TIMED_OUT)) {
                        g_debug ("No history as PackageKit took too long: %s",
                                 error_local->message);
-                       g_error_free (error_local);
                        for (l = list; l != NULL; l = l->next) {
                                app = GS_APP (l->data);
                                gs_app_set_install_date (app, GS_APP_INSTALL_DATE_UNKNOWN);
                        }
                }
-               g_propagate_error (error, error_local);
+               g_set_error (error,
+                            GS_PLUGIN_ERROR,
+                            GS_PLUGIN_ERROR_FAILED,
+                            "Failed to get history: %s",
+                            error_local->message);
                return FALSE;
        }
 
diff --git a/src/plugins/gs-plugin-systemd-updates.c b/src/plugins/gs-plugin-systemd-updates.c
index 74598dd..cdab5a8 100644
--- a/src/plugins/gs-plugin-systemd-updates.c
+++ b/src/plugins/gs-plugin-systemd-updates.c
@@ -116,10 +116,13 @@ gs_plugin_add_updates (GsPlugin *plugin,
                if (g_error_matches (error_local,
                                     PK_OFFLINE_ERROR,
                                     PK_OFFLINE_ERROR_NO_DATA)) {
-                       g_error_free (error_local);
                        return TRUE;
                }
-               g_propagate_error (error, error_local);
+               g_set_error (error,
+                            GS_PLUGIN_ERROR,
+                            GS_PLUGIN_ERROR_FAILED,
+                            "Failed to get prepared IDs: %s",
+                            error_local->message);
                return FALSE;
        }
 


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