[gnome-online-accounts] Clean up and sanitize some of the error messages
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] Clean up and sanitize some of the error messages
- Date: Thu, 14 Feb 2013 18:51:19 +0000 (UTC)
commit 8a20d70493259979752e0cf357888b97aa69e23e
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Feb 14 19:47:53 2013 +0100
Clean up and sanitize some of the error messages
The strings from goa_utils_lookup_credentials and
goa_utils_store_credentials are good enough. No need to prefix the
same thing again.
Also make sure that strings from on_handle_get_password are consistent
and meaningful across all relevant providers.
src/goabackend/goaexchangeprovider.c | 9 +++++----
src/goabackend/goagoogleprovider.c | 11 +++++------
src/goabackend/goaoauth2provider.c | 4 ----
src/goabackend/goaoauthprovider.c | 4 ----
src/goabackend/goaowncloudprovider.c | 9 +++++----
5 files changed, 15 insertions(+), 22 deletions(-)
---
diff --git a/src/goabackend/goaexchangeprovider.c b/src/goabackend/goaexchangeprovider.c
index 4a03fd0..4118f0f 100644
--- a/src/goabackend/goaexchangeprovider.c
+++ b/src/goabackend/goaexchangeprovider.c
@@ -289,8 +289,6 @@ ensure_credentials_sync (GoaProvider *provider,
{
if (error != NULL)
{
- g_prefix_error (error, _("Credentials not found in keyring (%s, %d): "),
- g_quark_to_string ((*error)->domain), (*error)->code);
(*error)->domain = GOA_ERROR;
(*error)->code = GOA_ERROR_NOT_AUTHORIZED;
}
@@ -307,7 +305,7 @@ ensure_credentials_sync (GoaProvider *provider,
{
*error = g_error_new (GOA_ERROR,
GOA_ERROR_NOT_AUTHORIZED,
- _("Did not find password with username `%s' in credentials"),
+ _("Did not find password with identity `%s' in credentials"),
username);
}
goto out;
@@ -989,6 +987,7 @@ on_handle_get_password (GoaPasswordBased *interface,
GoaProvider *provider;
GError *error;
GVariant *credentials;
+ const gchar *identity;
gchar *password;
/* TODO: maybe log what app is requesting access */
@@ -998,6 +997,7 @@ on_handle_get_password (GoaPasswordBased *interface,
object = GOA_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (interface)));
account = goa_object_peek_account (object);
+ identity = goa_account_get_identity (account);
provider = goa_provider_get_for_provider_type (goa_account_get_provider_type (account));
error = NULL;
@@ -1016,7 +1016,8 @@ on_handle_get_password (GoaPasswordBased *interface,
g_dbus_method_invocation_return_error (invocation,
GOA_ERROR,
GOA_ERROR_FAILED, /* TODO: more specific */
- _("Did not find password in credentials"));
+ _("Did not find password with identity `%s' in credentials"),
+ identity);
goto out;
}
diff --git a/src/goabackend/goagoogleprovider.c b/src/goabackend/goagoogleprovider.c
index e0f9a5b..fb5fe51 100644
--- a/src/goabackend/goagoogleprovider.c
+++ b/src/goabackend/goagoogleprovider.c
@@ -577,10 +577,6 @@ ensure_credentials_sync (GoaProvider *provider,
{
if (error != NULL)
{
- g_prefix_error (error,
- _("Credentials not found in keyring (%s, %d): "),
- g_quark_to_string ((*error)->domain),
- (*error)->code);
(*error)->domain = GOA_ERROR;
(*error)->code = GOA_ERROR_NOT_AUTHORIZED;
}
@@ -597,7 +593,7 @@ ensure_credentials_sync (GoaProvider *provider,
{
*error = g_error_new (GOA_ERROR,
GOA_ERROR_NOT_AUTHORIZED,
- _("Did not find password with username `%s' in credentials"),
+ _("Did not find password with identity `%s' in credentials"),
username);
}
goto out;
@@ -755,6 +751,7 @@ on_handle_get_password (GoaPasswordBased *interface,
GoaProvider *provider;
GError *error;
GVariant *credentials;
+ const gchar *identity;
gchar *password;
/* TODO: maybe log what app is requesting access */
@@ -764,6 +761,7 @@ on_handle_get_password (GoaPasswordBased *interface,
object = GOA_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (interface)));
account = goa_object_peek_account (object);
+ identity = goa_account_get_identity (account);
provider = goa_provider_get_for_provider_type (goa_account_get_provider_type (account));
error = NULL;
@@ -782,7 +780,8 @@ on_handle_get_password (GoaPasswordBased *interface,
g_dbus_method_invocation_return_error (invocation,
GOA_ERROR,
GOA_ERROR_FAILED, /* TODO: more specific */
- _("Did not find password in credentials"));
+ _("Did not find password with identity `%s' in credentials"),
+ identity);
goto out;
}
diff --git a/src/goabackend/goaoauth2provider.c b/src/goabackend/goaoauth2provider.c
index 9aedc33..4bc60fa 100644
--- a/src/goabackend/goaoauth2provider.c
+++ b/src/goabackend/goaoauth2provider.c
@@ -1519,8 +1519,6 @@ goa_oauth2_provider_get_access_token_sync (GoaOAuth2Provider *provider,
{
if (error != NULL)
{
- g_prefix_error (error, _("Credentials not found in keyring (%s, %d): "),
- g_quark_to_string ((*error)->domain), (*error)->code);
(*error)->domain = GOA_ERROR;
(*error)->code = GOA_ERROR_NOT_AUTHORIZED;
}
@@ -1624,8 +1622,6 @@ goa_oauth2_provider_get_access_token_sync (GoaOAuth2Provider *provider,
{
if (error != NULL)
{
- g_prefix_error (error, _("Error storing credentials in keyring (%s, %d): "),
- g_quark_to_string ((*error)->domain), (*error)->code);
(*error)->domain = GOA_ERROR;
(*error)->code = GOA_ERROR_NOT_AUTHORIZED;
}
diff --git a/src/goabackend/goaoauthprovider.c b/src/goabackend/goaoauthprovider.c
index b8d9c18..c1dae98 100644
--- a/src/goabackend/goaoauthprovider.c
+++ b/src/goabackend/goaoauthprovider.c
@@ -1542,8 +1542,6 @@ goa_oauth_provider_get_access_token_sync (GoaOAuthProvider *provider,
{
if (error != NULL)
{
- g_prefix_error (error, _("Credentials not found in keyring (%s, %d): "),
- g_quark_to_string ((*error)->domain), (*error)->code);
(*error)->domain = GOA_ERROR;
(*error)->code = GOA_ERROR_NOT_AUTHORIZED;
}
@@ -1649,8 +1647,6 @@ goa_oauth_provider_get_access_token_sync (GoaOAuthProvider *provider,
{
if (error != NULL)
{
- g_prefix_error (error, _("Error storing credentials in keyring (%s, %d): "),
- g_quark_to_string ((*error)->domain), (*error)->code);
(*error)->domain = GOA_ERROR;
(*error)->code = GOA_ERROR_NOT_AUTHORIZED;
}
diff --git a/src/goabackend/goaowncloudprovider.c b/src/goabackend/goaowncloudprovider.c
index ab3897c..ca3976f 100644
--- a/src/goabackend/goaowncloudprovider.c
+++ b/src/goabackend/goaowncloudprovider.c
@@ -342,8 +342,6 @@ ensure_credentials_sync (GoaProvider *provider,
{
if (error != NULL)
{
- g_prefix_error (error, _("Credentials not found in keyring (%s, %d): "),
- g_quark_to_string ((*error)->domain), (*error)->code);
(*error)->domain = GOA_ERROR;
(*error)->code = GOA_ERROR_NOT_AUTHORIZED;
}
@@ -363,7 +361,7 @@ ensure_credentials_sync (GoaProvider *provider,
{
*error = g_error_new (GOA_ERROR,
GOA_ERROR_NOT_AUTHORIZED,
- _("Did not find password with username `%s' in credentials"),
+ _("Did not find password with identity `%s' in credentials"),
username);
}
goto out;
@@ -1091,6 +1089,7 @@ on_handle_get_password (GoaPasswordBased *interface,
GoaProvider *provider;
GError *error;
GVariant *credentials;
+ const gchar *identity;
gchar *password;
/* TODO: maybe log what app is requesting access */
@@ -1100,6 +1099,7 @@ on_handle_get_password (GoaPasswordBased *interface,
object = GOA_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (interface)));
account = goa_object_peek_account (object);
+ identity = goa_account_get_identity (account);
provider = goa_provider_get_for_provider_type (goa_account_get_provider_type (account));
error = NULL;
@@ -1118,7 +1118,8 @@ on_handle_get_password (GoaPasswordBased *interface,
g_dbus_method_invocation_return_error (invocation,
GOA_ERROR,
GOA_ERROR_FAILED, /* TODO: more specific */
- _("Did not find password in credentials"));
+ _("Did not find password with identity `%s' in credentials"),
+ identity);
goto out;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]