[evolution-data-server] [CalDAV/CardDAV] Always set error on failed connection attempt
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] [CalDAV/CardDAV] Always set error on failed connection attempt
- Date: Thu, 23 Nov 2017 10:24:19 +0000 (UTC)
commit 4eba4e63ab198d88593b126aa5cd16f8ff04e9d7
Author: Milan Crha <mcrha redhat com>
Date: Thu Nov 23 11:21:10 2017 +0100
[CalDAV/CardDAV] Always set error on failed connection attempt
It had been finishing with no error set, but failure, when no credentials
had been provided. This could lead to "Unknown error" errors shown in
the UI for Google calendars/books with stored expired access tokens.
.../backends/webdav/e-book-backend-webdav.c | 13 ++++++-------
.../backends/caldav/e-cal-backend-caldav.c | 13 ++++++-------
2 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/src/addressbook/backends/webdav/e-book-backend-webdav.c
b/src/addressbook/backends/webdav/e-book-backend-webdav.c
index 8a0c116..b4c3ecf 100644
--- a/src/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/src/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -222,22 +222,21 @@ ebb_webdav_connect_sync (EBookMetaBackend *meta_backend,
if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_CANCELLED)) {
local_error->domain = G_IO_ERROR;
local_error->code = G_IO_ERROR_CANCELLED;
- g_propagate_error (error, local_error);
} else if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_FORBIDDEN) &&
credentials_empty) {
*out_auth_result = E_SOURCE_AUTHENTICATION_REQUIRED;
- g_clear_error (&local_error);
} else if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
if (credentials_empty)
*out_auth_result = E_SOURCE_AUTHENTICATION_REQUIRED;
else
*out_auth_result = E_SOURCE_AUTHENTICATION_REJECTED;
- g_clear_error (&local_error);
- } else if (local_error) {
+ } else if (!local_error) {
+ g_set_error_literal (&local_error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ _("Unknown error"));
+ }
+
+ if (local_error) {
g_propagate_error (error, local_error);
local_error = NULL;
- } else {
- g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Unknown error"));
}
if (is_ssl_error) {
diff --git a/src/calendar/backends/caldav/e-cal-backend-caldav.c
b/src/calendar/backends/caldav/e-cal-backend-caldav.c
index 75981d5..5f46f8e 100644
--- a/src/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/src/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -183,22 +183,21 @@ ecb_caldav_connect_sync (ECalMetaBackend *meta_backend,
if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_CANCELLED)) {
local_error->domain = G_IO_ERROR;
local_error->code = G_IO_ERROR_CANCELLED;
- g_propagate_error (error, local_error);
} else if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_FORBIDDEN) &&
credentials_empty) {
*out_auth_result = E_SOURCE_AUTHENTICATION_REQUIRED;
- g_clear_error (&local_error);
} else if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
if (credentials_empty)
*out_auth_result = E_SOURCE_AUTHENTICATION_REQUIRED;
else
*out_auth_result = E_SOURCE_AUTHENTICATION_REJECTED;
- g_clear_error (&local_error);
- } else if (local_error) {
+ } else if (!local_error) {
+ g_set_error_literal (&local_error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ _("Unknown error"));
+ }
+
+ if (local_error) {
g_propagate_error (error, local_error);
local_error = NULL;
- } else {
- g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Unknown error"));
}
if (is_ssl_error) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]