[evolution-data-server/openismus-work-master] EBookBackendFile: Report the proper error if a contact is not found by UID.



commit a0bea1d58f638553bd4d6e31c878ee5ad38ce18a
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Mon Jan 21 18:06:15 2013 +0900

    EBookBackendFile: Report the proper error if a contact is not found by UID.

 addressbook/backends/file/e-book-backend-file.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index ffe9be1..ee6f42e 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -1017,6 +1017,7 @@ e_book_backend_file_get_contact (EBookBackendSync *backend,
                                  GError **perror)
 {
 	EBookBackendFile *bf = E_BOOK_BACKEND_FILE (backend);
+	GError           *local_error = NULL;
 
 	if (!bf || !bf->priv || !bf->priv->sqlitedb) {
 		g_propagate_error (perror, EDB_NOT_OPENED_ERROR);
@@ -1027,7 +1028,22 @@ e_book_backend_file_get_contact (EBookBackendSync *backend,
 
 	*vcard = e_book_backend_sqlitedb_get_vcard_string (bf->priv->sqlitedb,
 							   SQLITEDB_FOLDER_ID, id,
-							   NULL, NULL, perror);
+							   NULL, NULL, &local_error);
+
+	if (local_error) {
+
+		if (g_error_matches (local_error,
+				     E_BOOK_SDB_ERROR,
+				     E_BOOK_SDB_ERROR_CONTACT_NOT_FOUND)) {
+			g_set_error (perror, E_BOOK_CLIENT_ERROR,
+				     E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND,
+				     _("Conflicting UIDs found in added contacts"));
+			g_error_free (local_error);
+		} else
+			g_propagate_error (perror, local_error);
+
+	}
+
 	g_rw_lock_reader_unlock (&(bf->priv->lock));
 }
 



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