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



commit d7e7a1485e4428d8886f199c388c4ad42459903a
Author: Richard Hughes <richard hughsie com>
Date:   Mon Sep 26 16:17:14 2016 +0100

    trivial: Always return errors with the correct domain

 src/gs-plugin-loader.c     |   22 ++++++++++++++++------
 src/plugins/gs-appstream.c |    4 +++-
 2 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 7e73cf1..6985781 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -33,6 +33,7 @@
 #include "gs-plugin-event.h"
 #include "gs-plugin-private.h"
 #include "gs-common.h"
+#include "gs-utils.h"
 
 #define GS_PLUGIN_LOADER_UPDATES_CHANGED_DELAY 3       /* s */
 #define GS_PLUGIN_LOADER_RELOAD_DELAY          5       /* s */
@@ -771,9 +772,10 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               ret = g_cancellable_set_error_if_cancelled (cancellable, error);
-               if (ret)
+               if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
+                       gs_utils_error_convert_gio (error);
                        return NULL;
+               }
 
                /* get symbol */
                exists = g_module_symbol (gs_plugin_get_module (plugin),
@@ -1113,8 +1115,10 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               if (g_cancellable_set_error_if_cancelled (cancellable, error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
+                       gs_utils_error_convert_gio (error);
                        return FALSE;
+               }
                exists = g_module_symbol (gs_plugin_get_module (plugin),
                                          function_name,
                                          (gpointer *) &plugin_func);
@@ -2992,8 +2996,10 @@ gs_plugin_loader_review_action_thread_cb (GTask *task,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               if (g_cancellable_set_error_if_cancelled (cancellable, &error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, &error)) {
+                       gs_utils_error_convert_gio (&error);
                        g_task_return_error (task, error);
+               }
 
                exists = g_module_symbol (gs_plugin_get_module (plugin),
                                          state->function_name,
@@ -3390,8 +3396,10 @@ gs_plugin_loader_auth_action_thread_cb (GTask *task,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               if (g_cancellable_set_error_if_cancelled (cancellable, &error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, &error)) {
+                       gs_utils_error_convert_gio (&error);
                        g_task_return_error (task, error);
+               }
 
                exists = g_module_symbol (gs_plugin_get_module (plugin),
                                          state->function_name,
@@ -4400,8 +4408,10 @@ gs_plugin_loader_run_refresh (GsPluginLoader *plugin_loader,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               if (g_cancellable_set_error_if_cancelled (cancellable, error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
+                       gs_utils_error_convert_gio (error);
                        return FALSE;
+               }
 
                exists = g_module_symbol (gs_plugin_get_module (plugin),
                                          function_name,
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index 37ba08b..0d1daec 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -818,8 +818,10 @@ gs_appstream_store_search (GsPlugin *plugin,
        g_assert (ptask != NULL);
        array = as_store_get_apps (store);
        for (i = 0; i < array->len; i++) {
-               if (g_cancellable_set_error_if_cancelled (cancellable, error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
+                       gs_utils_error_convert_gio (error);
                        return FALSE;
+               }
 
                item = g_ptr_array_index (array, i);
                ret = gs_appstream_store_search_item (plugin, item,


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