From 67f10091c97f5c5975fe620948803cec2e81aa34 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 19 Sep 2017 11:50:41 +0100 Subject: [PATCH 2/2] trivial: Add some error prefixes to better chase down bugs --- src/plugins/gs-plugin-packagekit-local.c | 8 ++++++-- src/plugins/gs-plugin-packagekit-origin.c | 4 +++- src/plugins/gs-plugin-packagekit-refine.c | 24 ++++++++++++++++++------ src/plugins/gs-plugin-packagekit-refresh.c | 5 ++++- src/plugins/gs-plugin-packagekit-upgrade.c | 1 + src/plugins/gs-plugin-packagekit.c | 28 ++++++++++++++++++++++------ 6 files changed, 54 insertions(+), 16 deletions(-) diff --git a/src/plugins/gs-plugin-packagekit-local.c b/src/plugins/gs-plugin-packagekit-local.c index 7d76c702..5e8d8022 100644 --- a/src/plugins/gs-plugin-packagekit-local.c +++ b/src/plugins/gs-plugin-packagekit-local.c @@ -102,8 +102,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)) { + g_prefix_error (error, "failed to get files local: "); return FALSE; + } array = pk_results_get_files_array (results); if (array->len == 0) { g_set_error (error, @@ -180,8 +182,10 @@ gs_plugin_file_to_app (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)) { + g_prefix_error (error, "failed to get details local: "); return FALSE; + } /* get results */ array = pk_results_get_details_array (results); diff --git a/src/plugins/gs-plugin-packagekit-origin.c b/src/plugins/gs-plugin-packagekit-origin.c index 4d81963c..4e6b3d14 100644 --- a/src/plugins/gs-plugin-packagekit-origin.c +++ b/src/plugins/gs-plugin-packagekit-origin.c @@ -86,8 +86,10 @@ gs_plugin_packagekit_origin_ensure_sources (GsPlugin *plugin, cancellable, NULL, plugin, error); - if (!gs_plugin_packagekit_results_valid (results, error)) + if (!gs_plugin_packagekit_results_valid (results, error)) { + g_prefix_error (error, "failed to get repo list: "); return FALSE; + } array = pk_results_get_repo_detail_array (results); for (i = 0; i < array->len; i++) { rd = g_ptr_array_index (array, i); diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c index b5c6f990..ec471f83 100644 --- a/src/plugins/gs-plugin-packagekit-refine.c +++ b/src/plugins/gs-plugin-packagekit-refine.c @@ -276,8 +276,10 @@ gs_plugin_packagekit_resolve_packages (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)) { + g_prefix_error (error, "failed to resolve packages: "); return FALSE; + } /* get results */ packages = pk_results_get_package_array (results); @@ -315,8 +317,10 @@ gs_plugin_packagekit_refine_from_desktop (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)) { + g_prefix_error (error, "failed to refine from desktop file: "); return FALSE; + } /* get results */ packages = pk_results_get_package_array (results); @@ -393,8 +397,10 @@ gs_plugin_packagekit_refine_updatedetails (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)) { + g_prefix_error (error, "failed to refine update details: "); return FALSE; + } /* set the update details for the update */ array = pk_results_get_update_detail_array (results); @@ -535,8 +541,10 @@ gs_plugin_packagekit_refine_details (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)) { + g_prefix_error (error, "failed to refine details: "); return FALSE; + } /* set the update details for the update */ array = pk_results_get_details_array (results); @@ -574,8 +582,10 @@ gs_plugin_packagekit_refine_update_urgency (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)) { + g_prefix_error (error, "failed to get updates: "); return FALSE; + } /* set the update severity for the app */ sack = pk_results_get_package_sack (results); @@ -765,8 +775,10 @@ gs_plugin_packagekit_refine_distro_upgrade (GsPlugin *plugin, error); pk_client_set_cache_age (priv->client, cache_age_save); - if (!gs_plugin_packagekit_results_valid (results, error)) + if (!gs_plugin_packagekit_results_valid (results, error)) { + g_prefix_error (error, "failed to refine distro upgrades: "); return FALSE; + } list = gs_app_list_new (); if (!gs_plugin_packagekit_add_results (plugin, list, results, error)) return FALSE; diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c index 68b81c5f..71c4d6fa 100644 --- a/src/plugins/gs-plugin-packagekit-refresh.c +++ b/src/plugins/gs-plugin-packagekit-refresh.c @@ -124,8 +124,10 @@ gs_plugin_refresh (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)) { + g_prefix_error (error, "failed to get updates: "); return FALSE; + } } /* download all the packages themselves */ @@ -145,6 +147,7 @@ gs_plugin_refresh (GsPlugin *plugin, gs_plugin_packagekit_progress_cb, &data, error); if (results2 == NULL) { + g_prefix_error (error, "failed to update packages: "); gs_plugin_packagekit_convert_gerror (error); return FALSE; } diff --git a/src/plugins/gs-plugin-packagekit-upgrade.c b/src/plugins/gs-plugin-packagekit-upgrade.c index 6791efc4..7a35df11 100644 --- a/src/plugins/gs-plugin-packagekit-upgrade.c +++ b/src/plugins/gs-plugin-packagekit-upgrade.c @@ -104,6 +104,7 @@ gs_plugin_app_upgrade_download (GsPlugin *plugin, gs_plugin_packagekit_progress_cb, &data, error); if (!gs_plugin_packagekit_results_valid (results, error)) { + g_prefix_error (error, "failed to upgrade system: "); gs_app_set_state_recover (app); return FALSE; } diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c index d0aecbc5..2059e117 100644 --- a/src/plugins/gs-plugin-packagekit.c +++ b/src/plugins/gs-plugin-packagekit.c @@ -132,8 +132,10 @@ gs_plugin_add_sources_related (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)) { + g_prefix_error (error, "failed to get packages: "); return FALSE; + } ret = gs_plugin_packagekit_add_results (plugin, installed, results, @@ -186,8 +188,10 @@ gs_plugin_add_sources (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)) { + g_prefix_error (error, "failed to get repo list: "); return FALSE; + } hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); array = pk_results_get_repo_detail_array (results); for (i = 0; i < array->len; i++) { @@ -238,8 +242,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)) { + g_prefix_error (error, "failed to enable repo: "); return FALSE; + } return TRUE; } @@ -302,6 +308,7 @@ gs_plugin_app_install (GsPlugin *plugin, gs_plugin_packagekit_progress_cb, &data, error); if (!gs_plugin_packagekit_results_valid (results, error)) { + g_prefix_error (error, "failed to install packages: "); gs_app_set_state_recover (app); return FALSE; } @@ -371,6 +378,7 @@ gs_plugin_app_install (GsPlugin *plugin, gs_plugin_packagekit_progress_cb, &data, error); if (!gs_plugin_packagekit_results_valid (results, error)) { + g_prefix_error (error, "failed to install packages: "); gs_app_set_state_recover (app); return FALSE; } @@ -396,6 +404,7 @@ gs_plugin_app_install (GsPlugin *plugin, gs_plugin_packagekit_progress_cb, &data, error); if (!gs_plugin_packagekit_results_valid (results, error)) { + g_prefix_error (error, "failed to install files: "); gs_app_set_state_recover (app); return FALSE; } @@ -445,8 +454,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)) { + g_prefix_error (error, "failed to disable source: "); return FALSE; + } return TRUE; } @@ -547,6 +558,7 @@ gs_plugin_app_remove (GsPlugin *plugin, gs_plugin_packagekit_progress_cb, &data, error); if (!gs_plugin_packagekit_results_valid (results, error)) { + g_prefix_error (error, "failed to remove packages: "); gs_app_set_state_recover (app); return FALSE; } @@ -587,8 +599,10 @@ gs_plugin_add_search_files (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)) { + g_prefix_error (error, "failed to search for files: "); return FALSE; + } /* add results */ return gs_plugin_packagekit_add_results (plugin, list, results, error); @@ -621,8 +635,10 @@ gs_plugin_add_search_what_provides (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)) { + g_prefix_error (error, "failed to search what provides: "); return FALSE; + } /* add results */ return gs_plugin_packagekit_add_results (plugin, list, results, error); -- 2.13.5