[gnome-software] trivial: Add ERROR_INVALID_FORMAT



commit 8fc824f5734c8f9171a20cf56445f29c55bbcac1
Author: Richard Hughes <richard hughsie com>
Date:   Wed Sep 7 15:02:01 2016 +0100

    trivial: Add ERROR_INVALID_FORMAT

 src/gs-plugin.c                                |    2 ++
 src/gs-plugin.h                                |    2 ++
 src/plugins/gs-flatpak.c                       |    4 ++--
 src/plugins/gs-plugin-epiphany.c               |    2 +-
 src/plugins/gs-plugin-fedora-distro-upgrades.c |    6 +++---
 src/plugins/gs-plugin-fwupd.c                  |    8 ++++----
 src/plugins/gs-plugin-odrs.c                   |   24 ++++++++++++------------
 src/plugins/gs-plugin-packagekit-local.c       |    6 +++---
 src/plugins/gs-plugin-shell-extensions.c       |   14 +++++++-------
 src/plugins/gs-plugin-snap.c                   |   20 ++++++++++----------
 src/plugins/gs-plugin-steam.c                  |    2 +-
 src/plugins/gs-plugin-systemd-updates.c        |    2 +-
 src/plugins/gs-plugin-ubuntuone.c              |   10 +++++-----
 src/plugins/gs-snapd.c                         |   24 ++++++++++++------------
 src/plugins/packagekit-common.c                |    2 +-
 15 files changed, 66 insertions(+), 62 deletions(-)
---
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index 74a4d0a..ea0d901 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -1307,6 +1307,8 @@ gs_plugin_error_to_string (GsPluginError error)
                return "download-failed";
        if (error == GS_PLUGIN_ERROR_WRITE_FAILED)
                return "write-failed";
+       if (error == GS_PLUGIN_ERROR_INVALID_FORMAT)
+               return "invalid-format";
        return NULL;
 }
 
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index a618d97..6331094 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -113,6 +113,7 @@ typedef guint64 GsPluginFlags;
  * @GS_PLUGIN_ERROR_PLUGIN_DEPSOLVE_FAILED:    The plugins installed are incompatible
  * @GS_PLUGIN_ERROR_DOWNLOAD_FAILED:           The download action failed
  * @GS_PLUGIN_ERROR_WRITE_FAILED:              The save-to-disk failed
+ * @GS_PLUGIN_ERROR_INVALID_FORMAT:            The data format is invalid
  *
  * The failure error types.
  **/
@@ -131,6 +132,7 @@ typedef enum {
        GS_PLUGIN_ERROR_PLUGIN_DEPSOLVE_FAILED,
        GS_PLUGIN_ERROR_DOWNLOAD_FAILED,
        GS_PLUGIN_ERROR_WRITE_FAILED,
+       GS_PLUGIN_ERROR_INVALID_FORMAT,
        /*< private >*/
        GS_PLUGIN_ERROR_LAST
 } GsPluginError;
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 51d564f..95747b8 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -768,7 +768,7 @@ gs_plugin_refine_item_origin_hostname (GsFlatpak *self, GsApp *app,
        if (url == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "no URL for remote %s",
                             flatpak_remote_get_name (xremote));
                return FALSE;
@@ -1749,7 +1749,7 @@ gs_flatpak_file_to_app_bundle (GsFlatpak *self,
                if (item == NULL) {
                        g_set_error (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "application %s not found",
                                     id);
                        return FALSE;
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index d561a18..c1d0324 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -266,7 +266,7 @@ gs_plugin_refine_app (GsPlugin *plugin,
        if (name == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "name unset for %s",
                             gs_app_get_id (app));
                return FALSE;
diff --git a/src/plugins/gs-plugin-fedora-distro-upgrades.c b/src/plugins/gs-plugin-fedora-distro-upgrades.c
index 92040b8..70056a2 100644
--- a/src/plugins/gs-plugin-fedora-distro-upgrades.c
+++ b/src/plugins/gs-plugin-fedora-distro-upgrades.c
@@ -122,7 +122,7 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        if (endptr == verstr || priv->os_version > G_MAXUINT) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "Failed parse VERSION_ID: %s", verstr);
                return FALSE;
        }
@@ -216,7 +216,7 @@ parse_pkgdb_collections_data (const gchar *data,
        if (root == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "no root object");
                return NULL;
        }
@@ -225,7 +225,7 @@ parse_pkgdb_collections_data (const gchar *data,
        if (collections == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "no collections object");
                return NULL;
        }
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 9168e48..23661c9 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -438,7 +438,7 @@ gs_plugin_add_update_app (GsPlugin *plugin,
                if (update_uri == NULL) {
                        g_set_error (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no location available for %s [%s]",
                                     gs_app_get_name (app), gs_app_get_id (app));
                        return FALSE;
@@ -456,7 +456,7 @@ gs_plugin_add_update_app (GsPlugin *plugin,
                        gs_plugin_fwupd_add_required_location (plugin, update_uri);
                        g_set_error (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "%s does not yet exist, wait patiently",
                                     filename_cache);
                        return FALSE;
@@ -471,7 +471,7 @@ gs_plugin_add_update_app (GsPlugin *plugin,
                if (g_strcmp0 (update_hash, checksum) != 0) {
                        g_set_error (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "%s does not match checksum, expected %s got %s",
                                     filename_cache, update_hash, checksum);
                        g_unlink (filename_cache);
@@ -815,7 +815,7 @@ gs_plugin_update_app (GsPlugin *plugin,
                if (device_id == NULL) {
                        g_set_error_literal (error,
                                             GS_PLUGIN_ERROR,
-                                            GS_PLUGIN_ERROR_FAILED,
+                                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                                             "not enough data for fwupd unlock");
                        return FALSE;
                }
diff --git a/src/plugins/gs-plugin-odrs.c b/src/plugins/gs-plugin-odrs.c
index 9fc9e4a..85093d2 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -122,14 +122,14 @@ gs_plugin_odrs_load_ratings (GsPlugin *plugin, const gchar *fn, GError **error)
        if (json_root == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no ratings root");
                return FALSE;
        }
        if (json_node_get_node_type (json_root) != JSON_NODE_OBJECT) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no ratings array");
                return FALSE;
        }
@@ -307,7 +307,7 @@ gs_plugin_odrs_parse_reviews (GsPlugin *plugin,
        if (data == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "server returned no data");
                return NULL;
        }
@@ -320,14 +320,14 @@ gs_plugin_odrs_parse_reviews (GsPlugin *plugin,
        if (json_root == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no root");
                return NULL;
        }
        if (json_node_get_node_type (json_root) != JSON_NODE_ARRAY) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no array");
                return NULL;
        }
@@ -345,7 +345,7 @@ gs_plugin_odrs_parse_reviews (GsPlugin *plugin,
                if (json_node_get_node_type (json_review) != JSON_NODE_OBJECT) {
                        g_set_error_literal (error,
                                             GS_PLUGIN_ERROR,
-                                            GS_PLUGIN_ERROR_FAILED,
+                                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                                             "no object type");
                        return NULL;
                }
@@ -353,7 +353,7 @@ gs_plugin_odrs_parse_reviews (GsPlugin *plugin,
                if (json_item == NULL) {
                        g_set_error_literal (error,
                                             GS_PLUGIN_ERROR,
-                                            GS_PLUGIN_ERROR_FAILED,
+                                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                                             "no object");
                        return NULL;
                }
@@ -378,7 +378,7 @@ gs_plugin_odrs_parse_success (const gchar *data, gssize data_len, GError **error
        if (data == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "server returned no data");
                return FALSE;
        }
@@ -391,14 +391,14 @@ gs_plugin_odrs_parse_success (const gchar *data, gssize data_len, GError **error
        if (json_root == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no error root");
                return FALSE;
        }
        if (json_node_get_node_type (json_root) != JSON_NODE_OBJECT) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no error object");
                return FALSE;
        }
@@ -406,7 +406,7 @@ gs_plugin_odrs_parse_success (const gchar *data, gssize data_len, GError **error
        if (json_item == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no error object");
                return FALSE;
        }
@@ -417,7 +417,7 @@ gs_plugin_odrs_parse_success (const gchar *data, gssize data_len, GError **error
        if (!json_object_get_boolean_member (json_item, "success")) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     msg != NULL ? msg : "unknown failure");
                return FALSE;
        }
diff --git a/src/plugins/gs-plugin-packagekit-local.c b/src/plugins/gs-plugin-packagekit-local.c
index 749825f..1a42913 100644
--- a/src/plugins/gs-plugin-packagekit-local.c
+++ b/src/plugins/gs-plugin-packagekit-local.c
@@ -142,7 +142,7 @@ gs_plugin_packagekit_refresh_guess_app_id (GsPlugin *plugin,
        if (array->len == 0) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "no files for %s", filename);
                return FALSE;
        }
@@ -222,14 +222,14 @@ gs_plugin_file_to_app (GsPlugin *plugin,
        if (array->len == 0) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "no details for %s", filename);
                return FALSE;
        }
        if (array->len > 1) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "too many details [%u] for %s",
                             array->len, filename);
                return FALSE;
diff --git a/src/plugins/gs-plugin-shell-extensions.c b/src/plugins/gs-plugin-shell-extensions.c
index 2bf06df..fe9df98 100644
--- a/src/plugins/gs-plugin-shell-extensions.c
+++ b/src/plugins/gs-plugin-shell-extensions.c
@@ -417,7 +417,7 @@ gs_plugin_shell_extensions_parse_version (GsPlugin *plugin,
        if (version == 0) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no version in map!");
                return FALSE;
        }
@@ -540,7 +540,7 @@ gs_plugin_shell_extensions_parse_apps (GsPlugin *plugin,
        if (data == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "server returned no data");
                return NULL;
        }
@@ -553,14 +553,14 @@ gs_plugin_shell_extensions_parse_apps (GsPlugin *plugin,
        if (json_root == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no data root");
                return NULL;
        }
        if (json_node_get_node_type (json_root) != JSON_NODE_OBJECT) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no data object");
                return NULL;
        }
@@ -568,7 +568,7 @@ gs_plugin_shell_extensions_parse_apps (GsPlugin *plugin,
        if (json_item == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no data object");
                return NULL;
        }
@@ -579,7 +579,7 @@ gs_plugin_shell_extensions_parse_apps (GsPlugin *plugin,
        if (json_extensions == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no extensions object");
                return NULL;
        }
@@ -587,7 +587,7 @@ gs_plugin_shell_extensions_parse_apps (GsPlugin *plugin,
        if (json_extensions_array == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "no extensions array");
                return NULL;
        }
diff --git a/src/plugins/gs-plugin-snap.c b/src/plugins/gs-plugin-snap.c
index 87c73f5..f613619 100644
--- a/src/plugins/gs-plugin-snap.c
+++ b/src/plugins/gs-plugin-snap.c
@@ -79,14 +79,14 @@ parse_result (const gchar *response, const gchar *response_type, GError **error)
        if (response_type == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "snapd returned no content type");
                return NULL;
        }
        if (g_strcmp0 (response_type, "application/json") != 0) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "snapd returned unexpected content type %s", response_type);
                return NULL;
        }
@@ -95,7 +95,7 @@ parse_result (const gchar *response, const gchar *response_type, GError **error)
        if (!json_parser_load_from_data (parser, response, -1, &error_local)) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "Unable to parse snapd response: %s",
                             error_local->message);
                return NULL;
@@ -103,7 +103,7 @@ parse_result (const gchar *response, const gchar *response_type, GError **error)
        if (!JSON_NODE_HOLDS_OBJECT (json_parser_get_root (parser))) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "snapd response does is not a valid JSON object");
                return NULL;
        }
@@ -310,7 +310,7 @@ get_apps (GsPlugin *plugin,
        if (status_code != SOUP_STATUS_OK) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "snapd returned status code %u: %s",
                             status_code, reason_phrase);
                return FALSE;
@@ -380,7 +380,7 @@ get_app (GsPlugin *plugin, GsApp *app, GCancellable *cancellable, GError **error
        if (status_code != SOUP_STATUS_OK) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "snapd returned status code %u: %s",
                             status_code, reason_phrase);
                return FALSE;
@@ -394,7 +394,7 @@ get_app (GsPlugin *plugin, GsApp *app, GCancellable *cancellable, GError **error
        if (result == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "snapd returned no results for %s", gs_app_get_id (app));
                return FALSE;
        }
@@ -499,7 +499,7 @@ send_package_action (GsPlugin *plugin,
        if (status_code != SOUP_STATUS_ACCEPTED) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "snapd returned status code %u: %s",
                             status_code, reason_phrase);
                return FALSE;
@@ -536,7 +536,7 @@ send_package_action (GsPlugin *plugin,
                        if (status_code != SOUP_STATUS_OK) {
                                g_set_error (error,
                                             GS_PLUGIN_ERROR,
-                                            GS_PLUGIN_ERROR_FAILED,
+                                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                                             "snapd returned status code %u: %s",
                                             status_code, status_reason_phrase);
                                return FALSE;
@@ -708,7 +708,7 @@ gs_plugin_auth_login (GsPlugin *plugin, GsAuth *auth,
        if (data == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "Failed to generate JSON request");
                return FALSE;
        }
diff --git a/src/plugins/gs-plugin-steam.c b/src/plugins/gs-plugin-steam.c
index ad1ebfd..fd7e74e 100644
--- a/src/plugins/gs-plugin-steam.c
+++ b/src/plugins/gs-plugin-steam.c
@@ -401,7 +401,7 @@ gs_plugin_steam_download_icon (GsPlugin *plugin,
            gdk_pixbuf_get_height (pb) < 48) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "icon is too small %ix%i",
                             gdk_pixbuf_get_width (pb),
                             gdk_pixbuf_get_height (pb));
diff --git a/src/plugins/gs-plugin-systemd-updates.c b/src/plugins/gs-plugin-systemd-updates.c
index c059359..8af162d 100644
--- a/src/plugins/gs-plugin-systemd-updates.c
+++ b/src/plugins/gs-plugin-systemd-updates.c
@@ -95,7 +95,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
                }
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "Failed to get prepared IDs: %s",
                             error_local->message);
                return FALSE;
diff --git a/src/plugins/gs-plugin-ubuntuone.c b/src/plugins/gs-plugin-ubuntuone.c
index 7db06f7..80f1ef9 100644
--- a/src/plugins/gs-plugin-ubuntuone.c
+++ b/src/plugins/gs-plugin-ubuntuone.c
@@ -119,7 +119,7 @@ gs_plugin_auth_login (GsPlugin *plugin, GsAuth *auth,
        if (data == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "Failed to generate JSON request");
                return FALSE;
        }
@@ -176,7 +176,7 @@ gs_plugin_auth_login (GsPlugin *plugin, GsAuth *auth,
        if (tmp == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "Response from %s missing required field consumer_key",
                             UBUNTU_LOGIN_HOST);
                return FALSE;
@@ -188,7 +188,7 @@ gs_plugin_auth_login (GsPlugin *plugin, GsAuth *auth,
        if (tmp == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "Response from %s missing required field consumer_secret",
                             UBUNTU_LOGIN_HOST);
                return FALSE;
@@ -200,7 +200,7 @@ gs_plugin_auth_login (GsPlugin *plugin, GsAuth *auth,
        if (tmp == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "Response from %s missing required field token_key",
                             UBUNTU_LOGIN_HOST);
                return FALSE;
@@ -212,7 +212,7 @@ gs_plugin_auth_login (GsPlugin *plugin, GsAuth *auth,
        if (tmp == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "Response from %s missing required field token_secret",
                             UBUNTU_LOGIN_HOST);
                return FALSE;
diff --git a/src/plugins/gs-snapd.c b/src/plugins/gs-snapd.c
index 0741ee2..82ec323 100644
--- a/src/plugins/gs-snapd.c
+++ b/src/plugins/gs-snapd.c
@@ -162,7 +162,7 @@ gs_snapd_request (const gchar  *method,
        if (!body) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "Unable to find header separator in snapd response");
                return FALSE;
        }
@@ -177,7 +177,7 @@ gs_snapd_request (const gchar  *method,
                                          NULL, &code, reason_phrase)) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "snapd response HTTP headers not parseable");
                return FALSE;
        }
@@ -193,7 +193,7 @@ gs_snapd_request (const gchar  *method,
                        if (n_read == max_data_length) {
                                g_set_error_literal (error,
                                                     GS_PLUGIN_ERROR,
-                                                    GS_PLUGIN_ERROR_FAILED,
+                                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                                     "Out of space reading snapd response");
                                return FALSE;
                        }
@@ -225,7 +225,7 @@ gs_snapd_request (const gchar  *method,
                if (!chunk_start) {
                        g_set_error_literal (error,
                                             GS_PLUGIN_ERROR,
-                                            GS_PLUGIN_ERROR_FAILED,
+                                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                                             "Unable to find chunk header in "
                                             "snapd response");
                        return FALSE;
@@ -238,7 +238,7 @@ gs_snapd_request (const gchar  *method,
                if (n_required > max_data_length) {
                        g_set_error (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "Not enough space for snapd response, "
                                     "require %" G_GSIZE_FORMAT " octets, "
                                     "have %" G_GSIZE_FORMAT,
@@ -263,7 +263,7 @@ gs_snapd_request (const gchar  *method,
                if (n_required > max_data_length) {
                        g_set_error (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "Not enough space for snapd response, "
                                     "require %" G_GSIZE_FORMAT " octets, "
                                     "have %" G_GSIZE_FORMAT,
@@ -283,7 +283,7 @@ gs_snapd_request (const gchar  *method,
        default:
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "Unable to determine content "
                                     "length of snapd response");
                return FALSE;
@@ -316,14 +316,14 @@ gs_snapd_parse_result (const gchar        *response_type,
        if (response_type == NULL) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "snapd returned no content type");
                return FALSE;
        }
        if (g_strcmp0 (response_type, "application/json") != 0) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "snapd returned unexpected content type %s", response_type);
                return FALSE;
        }
@@ -332,7 +332,7 @@ gs_snapd_parse_result (const gchar  *response_type,
        if (!json_parser_load_from_data (parser, response, -1, &error_local)) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "Unable to parse snapd response: %s",
                             error_local->message);
                return FALSE;
@@ -341,7 +341,7 @@ gs_snapd_parse_result (const gchar  *response_type,
        if (!JSON_NODE_HOLDS_OBJECT (json_parser_get_root (parser))) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "snapd response does is not a valid JSON object");
                return FALSE;
        }
@@ -349,7 +349,7 @@ gs_snapd_parse_result (const gchar  *response_type,
        if (!json_object_has_member (root, "result")) {
                g_set_error_literal (error,
                                     GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_FAILED,
+                                    GS_PLUGIN_ERROR_INVALID_FORMAT,
                                     "snapd response does not contain a \"result\" field");
                return FALSE;
        }
diff --git a/src/plugins/packagekit-common.c b/src/plugins/packagekit-common.c
index 8812b39..2aeedef 100644
--- a/src/plugins/packagekit-common.c
+++ b/src/plugins/packagekit-common.c
@@ -197,7 +197,7 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin,
        if (error_code != NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
+                            GS_PLUGIN_ERROR_INVALID_FORMAT,
                             "failed to get-packages: %s, %s",
                             pk_error_enum_to_string (pk_error_get_code (error_code)),
                             pk_error_get_details (error_code));


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