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



commit e0a5041e96bd52cb0080eb5cd5f7ed4ef8696277
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.
    
    Conflicts:
    
    	addressbook/backends/file/e-book-backend-file.c

 addressbook/backends/file/e-book-backend-file.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index e13bd8a..b86384c 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -981,6 +981,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);
@@ -989,7 +990,21 @@ 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,
+				     _("Contact '%s' not found"), id);
+			g_error_free (local_error);
+		} else
+			g_propagate_error (perror, local_error);
+
+	}
 }
 
 static void



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