[evolution-data-server/openismus-work: 86/122] Updated revision guards API to return an E_CLIENT_ERROR



commit 44410183e6fd074ffbf3226cc3951ced2cc8e72c
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri Dec 7 16:48:28 2012 +0900

    Updated revision guards API to return an E_CLIENT_ERROR
    
    Use the new E_CLIENT_ERROR_OUT_OF_SYNC code which is common to
    the backend and frontend libraries, instead of the
    E_DATA_BOOK_STATUS_BAD_REVISION which is not mean for clients to see.

 addressbook/backends/file/e-book-backend-file.c    |    5 ++++-
 .../libebook-contacts/e-book-contacts-types.h      |    3 +--
 libedataserver/e-client.h                          |    3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 84cba1f..4915dce 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -924,7 +924,10 @@ e_book_backend_file_modify_contacts (EBookBackendSync *backend,
 
 			if (!contact_rev || !old_contact_rev ||
 			    strcmp (contact_rev, old_contact_rev) != 0) {
-				g_propagate_error (perror, EDB_ERROR_EX (BAD_REVISION, _("Out of sync revision")));
+				g_set_error (perror, E_CLIENT_ERROR,
+					     E_CLIENT_ERROR_OUT_OF_SYNC,
+					     _("Tried to modify contact '%s' with out of sync revision"),
+					     e_contact_get_const (contact, E_CONTACT_UID));
 
 				status = STATUS_ERROR;
 
diff --git a/addressbook/libebook-contacts/e-book-contacts-types.h b/addressbook/libebook-contacts/e-book-contacts-types.h
index 175697b..a374a16 100644
--- a/addressbook/libebook-contacts/e-book-contacts-types.h
+++ b/addressbook/libebook-contacts/e-book-contacts-types.h
@@ -71,8 +71,7 @@ typedef enum {
 	E_DATA_BOOK_STATUS_NO_SPACE,
 	E_DATA_BOOK_STATUS_INVALID_ARG,
 	E_DATA_BOOK_STATUS_NOT_SUPPORTED,
-	E_DATA_BOOK_STATUS_NOT_OPENED,
-	E_DATA_BOOK_STATUS_BAD_REVISION
+	E_DATA_BOOK_STATUS_NOT_OPENED
 } EDataBookStatus;
 
 typedef enum {
diff --git a/libedataserver/e-client.h b/libedataserver/e-client.h
index cafcc45..915c413 100644
--- a/libedataserver/e-client.h
+++ b/libedataserver/e-client.h
@@ -156,7 +156,8 @@ typedef enum {
 	E_CLIENT_ERROR_QUERY_REFUSED,
 	E_CLIENT_ERROR_DBUS_ERROR,
 	E_CLIENT_ERROR_OTHER_ERROR,
-	E_CLIENT_ERROR_NOT_OPENED
+	E_CLIENT_ERROR_NOT_OPENED,
+	E_CLIENT_ERROR_OUT_OF_SYNC
 } EClientError;
 
 const gchar *	e_client_error_to_string (EClientError code);



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