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



commit 588da2a2a8b646205a032ac6bc3fee2dd77578a5
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 1e9ba4a..e7bc6cd 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_DATA_BOOK_ERROR,
+				     E_DATA_BOOK_STATUS_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]