[gnome-software] Add the unique ID of the cached origin to some error messages
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add the unique ID of the cached origin to some error messages
- Date: Thu, 8 Sep 2016 20:56:00 +0000 (UTC)
commit ad03006b4aeca499d5e0a10948644141bbe252db
Author: Richard Hughes <richard hughsie com>
Date: Thu Sep 8 13:30:40 2016 +0100
Add the unique ID of the cached origin to some error messages
This will allow us to discover in an easy-to-localize way where the download
failure is coming from.
src/plugins/gs-plugin-dummy.c | 5 ++++-
src/plugins/gs-plugin-fedora-distro-upgrades.c | 16 +++++++++++-----
src/plugins/gs-plugin-fwupd.c | 8 ++++++--
src/plugins/gs-plugin-odrs.c | 6 +++++-
src/plugins/gs-plugin-packagekit-local.c | 4 +++-
src/plugins/gs-plugin-packagekit.c | 8 ++++++--
src/plugins/gs-plugin-shell-extensions.c | 4 +++-
7 files changed, 38 insertions(+), 13 deletions(-)
---
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index c758684..be5655d 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -380,6 +380,8 @@ gs_plugin_update_app (GsPlugin *plugin,
GCancellable *cancellable,
GError **error)
{
+ GsPluginData *priv = gs_plugin_get_data (plugin);
+
/* only process this app if was created by this plugin */
if (g_strcmp0 (gs_app_get_management_plugin (app),
gs_plugin_get_name (plugin)) != 0)
@@ -388,8 +390,9 @@ gs_plugin_update_app (GsPlugin *plugin,
/* always fail */
g_set_error_literal (error,
GS_PLUGIN_ERROR,
- GS_PLUGIN_ERROR_NO_NETWORK,
+ GS_PLUGIN_ERROR_DOWNLOAD_FAILED,
"no network connection is available");
+ gs_utils_error_add_unique_id (error, priv->cached_origin);
return FALSE;
}
diff --git a/src/plugins/gs-plugin-fedora-distro-upgrades.c b/src/plugins/gs-plugin-fedora-distro-upgrades.c
index 99b302c..d89ee7d 100644
--- a/src/plugins/gs-plugin-fedora-distro-upgrades.c
+++ b/src/plugins/gs-plugin-fedora-distro-upgrades.c
@@ -167,11 +167,17 @@ gs_plugin_fedora_distro_upgrades_refresh (GsPlugin *plugin,
}
/* download new file */
- return gs_plugin_download_file (plugin, NULL,
- FEDORA_PKGDB_COLLECTIONS_API_URI,
- priv->cachefn,
- cancellable,
- error);
+ if (!gs_plugin_download_file (plugin, NULL,
+ FEDORA_PKGDB_COLLECTIONS_API_URI,
+ priv->cachefn,
+ cancellable,
+ error)) {
+ gs_utils_error_add_unique_id (error, priv->cached_origin);
+ return FALSE;
+ }
+
+ /* success */
+ return TRUE;
}
gboolean
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 4063550..02bbc68 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -629,8 +629,10 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
url_sig,
cancellable,
error);
- if (data == NULL)
+ if (data == NULL) {
+ gs_utils_error_add_unique_id (error, priv->cached_origin);
return FALSE;
+ }
/* is the signature hash the same as we had before? */
checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA1,
@@ -673,8 +675,10 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
priv->download_uri,
cache_fn_data,
cancellable,
- error))
+ error)) {
+ gs_utils_error_add_unique_id (error, priv->cached_origin);
return FALSE;
+ }
/* phew, lets send all this to fwupd */
if (!fwupd_client_update_metadata (priv->client,
diff --git a/src/plugins/gs-plugin-odrs.c b/src/plugins/gs-plugin-odrs.c
index bedbec8..c30f8ec 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -194,8 +194,10 @@ gs_plugin_odrs_refresh_ratings (GsPlugin *plugin,
/* download the complete file */
uri = g_strdup_printf ("%s/ratings", priv->review_server);
- if (!gs_plugin_download_file (plugin, app_dl, uri, fn, cancellable, error))
+ if (!gs_plugin_download_file (plugin, app_dl, uri, fn, cancellable, error)) {
+ gs_utils_error_add_unique_id (error, priv->cached_origin);
return FALSE;
+ }
return gs_plugin_odrs_load_ratings (plugin, fn, error);
}
@@ -581,6 +583,7 @@ gs_plugin_odrs_fetch_for_app (GsPlugin *plugin, GsApp *app, GError **error)
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_DOWNLOAD_FAILED,
"status code invalid");
+ gs_utils_error_add_unique_id (error, priv->cached_origin);
return NULL;
}
reviews = gs_plugin_odrs_parse_reviews (plugin,
@@ -961,6 +964,7 @@ gs_plugin_add_unvoted_reviews (GsPlugin *plugin,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_DOWNLOAD_FAILED,
"status code invalid");
+ gs_utils_error_add_unique_id (error, priv->cached_origin);
return FALSE;
}
g_debug ("odrs returned: %s", msg->response_body->data);
diff --git a/src/plugins/gs-plugin-packagekit-local.c b/src/plugins/gs-plugin-packagekit-local.c
index 1a42913..42fcd48 100644
--- a/src/plugins/gs-plugin-packagekit-local.c
+++ b/src/plugins/gs-plugin-packagekit-local.c
@@ -136,8 +136,10 @@ gs_plugin_packagekit_refresh_guess_app_id (GsPlugin *plugin,
cancellable,
gs_plugin_packagekit_progress_cb, &data,
error);
- if (!gs_plugin_packagekit_results_valid (results, error))
+ if (!gs_plugin_packagekit_results_valid (results, error)) {
+ gs_utils_error_add_unique_id (error, app);
return FALSE;
+ }
array = pk_results_get_files_array (results);
if (array->len == 0) {
g_set_error (error,
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 0e9d68b..bef3bb9 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -239,8 +239,10 @@ gs_plugin_app_source_enable (GsPlugin *plugin,
cancellable,
gs_plugin_packagekit_progress_cb, &data,
error);
- if (!gs_plugin_packagekit_results_valid (results, error))
+ if (!gs_plugin_packagekit_results_valid (results, error)) {
+ gs_utils_error_add_unique_id (error, app);
return FALSE;
+ }
return TRUE;
}
@@ -439,8 +441,10 @@ gs_plugin_app_source_disable (GsPlugin *plugin,
cancellable,
gs_plugin_packagekit_progress_cb, &data,
error);
- if (!gs_plugin_packagekit_results_valid (results, error))
+ if (!gs_plugin_packagekit_results_valid (results, error)) {
+ gs_utils_error_add_unique_id (error, app);
return FALSE;
+ }
return TRUE;
}
diff --git a/src/plugins/gs-plugin-shell-extensions.c b/src/plugins/gs-plugin-shell-extensions.c
index 2fc11d6..5b22a9f 100644
--- a/src/plugins/gs-plugin-shell-extensions.c
+++ b/src/plugins/gs-plugin-shell-extensions.c
@@ -663,8 +663,10 @@ gs_plugin_shell_extensions_get_apps (GsPlugin *plugin,
SHELL_EXTENSIONS_API_URI,
priv->shell_version);
data = gs_plugin_download_data (plugin, dummy, uri, cancellable, error);
- if (data == NULL)
+ if (data == NULL) {
+ gs_utils_error_add_unique_id (error, priv->cached_origin);
return NULL;
+ }
apps = gs_plugin_shell_extensions_parse_apps (plugin,
g_bytes_get_data (data, NULL),
(gssize) g_bytes_get_size (data),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]