[gnome-online-accounts] utils: Sanitize name resolution failures and wrong server values
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] utils: Sanitize name resolution failures and wrong server values
- Date: Thu, 1 Oct 2015 16:34:47 +0000 (UTC)
commit b0c18d5bf1af242a9e6602d80a26a2c61000dcc4
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Oct 1 18:29:48 2015 +0200
utils: Sanitize name resolution failures and wrong server values
Other than SOUP_STATUS_UNAUTHORIZED, these are the more common
failures encountered by a user. The name resolution failures are quite
obvious, but failures arising due to subtle mistakes in the server
string entered by the user are harder to detect. In my limited testing,
failures to find the WebDAV endpoint either led to
SOUP_STATUS_INTERNAL_SERVER_ERROR or SOUP_STATUS_NOT_FOUND.
Note that even though SoupMessage:reason_phrase gets a localized error
string from glib-networking in the case of name resolution failures,
the documentation (see soup_status_get_phrase) explicitly says
otherwise and advises against presenting them to the user. So, let's
not get into uncharted waters.
https://bugzilla.gnome.org/show_bug.cgi?id=755168
src/goabackend/goautils.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/goabackend/goautils.c b/src/goabackend/goautils.c
index 2433bec..bb40487 100644
--- a/src/goabackend/goautils.c
+++ b/src/goabackend/goautils.c
@@ -534,6 +534,19 @@ goa_utils_set_error_soup (GError **err, SoupMessage *msg)
switch (msg->status_code)
{
+ case SOUP_STATUS_CANT_RESOLVE:
+ error_msg = g_strdup (_("Cannot resolve hostname"));
+ break;
+
+ case SOUP_STATUS_CANT_RESOLVE_PROXY:
+ error_msg = g_strdup (_("Cannot resolve proxy hostname"));
+ break;
+
+ case SOUP_STATUS_INTERNAL_SERVER_ERROR:
+ case SOUP_STATUS_NOT_FOUND:
+ error_msg = g_strdup (_("Cannot find WebDAV endpoint"));
+ break;
+
case SOUP_STATUS_UNAUTHORIZED:
error_msg = g_strdup (_("Authentication failed"));
error_code = GOA_ERROR_NOT_AUTHORIZED;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]