[evolution-data-server] Bug #589325 - Incorrect error on Google Contacts authentication failure



commit cb9fa63659e877ef7eb61f1db8fffb9eabcf20c1
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jul 22 11:47:24 2009 +0200

    Bug #589325 - Incorrect error on Google Contacts authentication failure

 .../backends/google/e-book-backend-google.c        |   21 ++++++++++++++++++-
 addressbook/backends/google/google-book.c          |    2 +-
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c
index afe0e4c..eddd9bf 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -373,7 +373,7 @@ e_book_backend_google_authenticate_user (EBookBackendSync *backend,
     g_free (book_username);
     if (FALSE == match) {
 	g_warning ("Username given when loading source and on authentication did not match!");
-	return GNOME_Evolution_Addressbook_OtherError;
+	return GNOME_Evolution_Addressbook_AuthenticationRequired;
     }
 
     google_book_connect_to_google (priv->book, password, &error);
@@ -686,6 +686,23 @@ e_book_backend_google_new (void)
 static EBookBackendSyncStatus
 e_book_backend_status_from_google_book_error (GoogleBookError error_code)
 {
-    return GNOME_Evolution_Addressbook_OtherError;
+	switch (error_code) {
+	case GOOGLE_BOOK_ERROR_NONE:
+		return GNOME_Evolution_Addressbook_Success;
+	case GOOGLE_BOOK_ERROR_CONTACT_NOT_FOUND:
+		return GNOME_Evolution_Addressbook_ContactNotFound;
+	case GOOGLE_BOOK_ERROR_CONFLICT:
+		return GNOME_Evolution_Addressbook_ContactIdAlreadyExists;
+	case GOOGLE_BOOK_ERROR_AUTH_FAILED:
+		return GNOME_Evolution_Addressbook_AuthenticationFailed;
+	case GOOGLE_BOOK_ERROR_AUTH_REQUIRED:
+		return GNOME_Evolution_Addressbook_AuthenticationRequired;
+	case GOOGLE_BOOK_ERROR_INVALID_CONTACT:
+	case GOOGLE_BOOK_ERROR_NETWORK_ERROR:
+	case GOOGLE_BOOK_ERROR_HTTP_ERROR:
+		break;
+	}
+
+	return GNOME_Evolution_Addressbook_OtherError;
 }
 
diff --git a/addressbook/backends/google/google-book.c b/addressbook/backends/google/google-book.c
index f6086c4..566de42 100644
--- a/addressbook/backends/google/google-book.c
+++ b/addressbook/backends/google/google-book.c
@@ -1244,7 +1244,7 @@ google_book_error_from_soup_error (GError     *soup_error,
     }
     g_set_error (error,
                 GOOGLE_BOOK_ERROR,
-                GOOGLE_BOOK_ERROR_HTTP_ERROR,
+                code,
                 "%s due to '%s' (HTTP code %d)",
                 message ? message : "Action failed",
                 soup_error->message,



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