[evolution-exchange] Bug #623204 - Be able to report detailed errors from backends



commit e201a9ad9682557d5998df586d07fd3ba8d6aa17
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jul 9 14:32:08 2010 +0200

    Bug #623204 - Be able to report detailed errors from backends

 addressbook/e-book-backend-exchange.c      |  318 +++++++++++++-----------
 addressbook/e-book-backend-gal.c           |  377 ++++++++++++++++------------
 calendar/e-cal-backend-exchange-calendar.c |  324 +++++++++++++-----------
 calendar/e-cal-backend-exchange-tasks.c    |  153 ++++++-----
 calendar/e-cal-backend-exchange.c          |  307 ++++++++++++-----------
 calendar/e-cal-backend-exchange.h          |   13 +-
 configure.ac                               |    2 +
 7 files changed, 806 insertions(+), 688 deletions(-)
---
diff --git a/addressbook/e-book-backend-exchange.c b/addressbook/e-book-backend-exchange.c
index 4dfc027..fe22fb3 100644
--- a/addressbook/e-book-backend-exchange.c
+++ b/addressbook/e-book-backend-exchange.c
@@ -94,6 +94,9 @@ struct EBookBackendExchangePrivate {
 /* vCard parameter name in contact list */
 #define EEX_X_MEMBERID "X-EEX-MEMBER-ID"
 
+#define EDB_ERROR(_code) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, NULL)
+#define EDB_ERROR_EX(_code, _msg) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, _msg)
+
 typedef struct PropMapping PropMapping;
 
 static void subscription_notify (E2kContext *ctx, const gchar *uri, E2kContextChangeType type, gpointer user_data);
@@ -115,19 +118,22 @@ static GPtrArray *field_names_array;
 static const gchar **field_names;
 static gint n_field_names;
 
-static GNOME_Evolution_Addressbook_CallStatus
-http_status_to_pas (E2kHTTPStatus status)
+static void
+http_status_to_error (E2kHTTPStatus status, GError **perror)
 {
 	if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status))
-		return GNOME_Evolution_Addressbook_Success;
+		return;
 
 	switch (status) {
 	case E2K_HTTP_UNAUTHORIZED:
-		return GNOME_Evolution_Addressbook_PermissionDenied;
+		g_propagate_error (perror, EDB_ERROR (PERMISSION_DENIED));
+		break;
 	case E2K_HTTP_CANT_CONNECT:
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+		g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+		break;
 	default:
-		return GNOME_Evolution_Addressbook_OtherError;
+		g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, _("Operation failed with status %d"), status));
+		break;
 	}
 }
 
@@ -673,8 +679,8 @@ update_cache (EBookBackendExchange *be)
 	return TRUE;
 }
 
-static GNOME_Evolution_Addressbook_CallStatus
-e_book_backend_exchange_connect (EBookBackendExchange *be)
+static gboolean
+e_book_backend_exchange_connect (EBookBackendExchange *be, GError **perror)
 {
 	EBookBackendExchangePrivate *bepriv = be->priv;
 	ExchangeHierarchy *hier;
@@ -688,13 +694,17 @@ e_book_backend_exchange_connect (EBookBackendExchange *be)
 
 	if (!bepriv->account) {
 		bepriv->account = exchange_share_config_listener_get_account_for_uri (NULL, bepriv->exchange_uri);
-		if (!bepriv->account)
-			return GNOME_Evolution_Addressbook_RepositoryOffline;
+		if (!bepriv->account) {
+			g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+			return FALSE;
+		}
 	}
 	if (!bepriv->ctx) {
 		bepriv->ctx = exchange_account_get_context (bepriv->account);
-		if (!bepriv->ctx)
-			return GNOME_Evolution_Addressbook_RepositoryOffline;
+		if (!bepriv->ctx) {
+			g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+			return FALSE;
+		}
 	}
 
 	bepriv->folder = exchange_account_get_folder (bepriv->account, bepriv->exchange_uri);
@@ -704,7 +714,8 @@ e_book_backend_exchange_connect (EBookBackendExchange *be)
 		/* Rescan the hierarchy to see if any new addressbooks got added */
 		hier = exchange_account_get_hierarchy_by_type (bepriv->account, EXCHANGE_HIERARCHY_PERSONAL);
 		if (!hier) {
-			return GNOME_Evolution_Addressbook_RepositoryOffline;
+			g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+			return FALSE;
 		}
 		g_object_ref (hier->toplevel);
 		e_folder_exchange_set_rescan_tree (hier->toplevel, TRUE);
@@ -713,8 +724,10 @@ e_book_backend_exchange_connect (EBookBackendExchange *be)
 		g_object_unref (hier->toplevel);
 
 		bepriv->folder = exchange_account_get_folder (bepriv->account, bepriv->exchange_uri);
-		if (!bepriv->folder)
-			return GNOME_Evolution_Addressbook_RepositoryOffline;
+		if (!bepriv->folder) {
+			g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+			return FALSE;
+		}
 	}
 	g_object_ref (bepriv->folder);
 
@@ -725,7 +738,8 @@ e_book_backend_exchange_connect (EBookBackendExchange *be)
 
 	if (status != E2K_HTTP_MULTI_STATUS) {
 		bepriv->connected = FALSE;
-		return GNOME_Evolution_Addressbook_OtherError;
+		http_status_to_error (status, perror);
+		return FALSE;
 	}
 
 	access_prop = e2k_properties_get_prop (results[0].props, PR_ACCESS);
@@ -738,7 +752,8 @@ e_book_backend_exchange_connect (EBookBackendExchange *be)
 		bepriv->connected = FALSE;
 		if (nresults)
 			e2k_results_free (results, nresults);
-		return GNOME_Evolution_Addressbook_PermissionDenied;
+		g_propagate_error (perror, EDB_ERROR (PERMISSION_DENIED));
+		return FALSE;
 	}
 
 	bepriv->is_writable = ((access & MAPI_ACCESS_CREATE_CONTENTS) != 0);
@@ -803,7 +818,8 @@ e_book_backend_exchange_connect (EBookBackendExchange *be)
 	e_book_backend_set_is_loaded (E_BOOK_BACKEND (be), TRUE);
 	if (nresults)
 		e2k_results_free (results, nresults);
-	return GNOME_Evolution_Addressbook_Success;
+
+	return TRUE;
 }
 
 static gboolean
@@ -1637,12 +1653,13 @@ merge_contact_lists (EBookBackendExchange *be, const gchar *location, EContact *
 	return status;
 }
 
-static EBookBackendSyncStatus
+static void
 e_book_backend_exchange_create_contact (EBookBackendSync  *backend,
 					EDataBook         *book,
 					guint32            opid,
 					const gchar        *vcard,
-					EContact         **contact)
+					EContact         **contact,
+					GError **perror)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
@@ -1657,12 +1674,13 @@ e_book_backend_exchange_create_contact (EBookBackendSync  *backend,
 
 	switch (bepriv->mode) {
 
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+	case E_DATA_BOOK_MODE_LOCAL:
 		*contact = NULL;
 		UNLOCK (bepriv);
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+		g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
+	case E_DATA_BOOK_MODE_REMOTE:
 		*contact = e_contact_new_from_vcard (vcard);
 
 		/* figure out the right uri to be using */
@@ -1671,13 +1689,9 @@ e_book_backend_exchange_create_contact (EBookBackendSync  *backend,
 			name = "No Subject";
 
 		if (!bepriv->connected || !bepriv->ctx || !bepriv->summary) {
-			GNOME_Evolution_Addressbook_CallStatus state;
-
-			state = e_book_backend_exchange_connect (be);
-			if ( state != GNOME_Evolution_Addressbook_Success) {
-				d(printf("Returning status %d while creating contact\n", state));
+			if (!e_book_backend_exchange_connect (be, perror)) {
 				UNLOCK (bepriv);
-				return state;
+				return;
 			}
 		}
 
@@ -1722,26 +1736,27 @@ e_book_backend_exchange_create_contact (EBookBackendSync  *backend,
 							    *contact);
 			e_book_backend_cache_add_contact (bepriv->cache, *contact);
 			UNLOCK (bepriv);
-			return GNOME_Evolution_Addressbook_Success;
+			return;
 		} else {
 			g_object_unref (*contact);
 			*contact = NULL;
 			UNLOCK (bepriv);
-			return http_status_to_pas (status);
+			http_status_to_error (status, perror);
+			return;
 		}
 	default:
 		break;
 	}
 	UNLOCK (bepriv);
-	return GNOME_Evolution_Addressbook_Success;
 }
 
-static EBookBackendSyncStatus
+static void
 e_book_backend_exchange_modify_contact (EBookBackendSync  *backend,
 					EDataBook         *book,
 					guint32	  opid,
 					const gchar        *vcard,
-					EContact         **contact)
+					EContact         **contact,
+					GError **perror)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
@@ -1756,22 +1771,19 @@ e_book_backend_exchange_modify_contact (EBookBackendSync  *backend,
 
 	switch (bepriv->mode) {
 
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+	case E_DATA_BOOK_MODE_LOCAL:
 		*contact = NULL;
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+		g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
+	case E_DATA_BOOK_MODE_REMOTE:
 
 		*contact = e_contact_new_from_vcard (vcard);
 		uri = e_contact_get_const (*contact, E_CONTACT_UID);
 
 		if (!bepriv->connected || !bepriv->ctx || !bepriv->summary) {
-			GNOME_Evolution_Addressbook_CallStatus state;
-
-			state = e_book_backend_exchange_connect (be);
-			if ( state != GNOME_Evolution_Addressbook_Success) {
-				d(printf("Returning status %d while modifying contact\n", state));
-				return state;
+			if (!e_book_backend_exchange_connect (be, perror)) {
+				return;
 			}
 		}
 
@@ -1782,7 +1794,8 @@ e_book_backend_exchange_modify_contact (EBookBackendSync  *backend,
 			g_object_unref (book);
 			g_object_unref (*contact);
 			*contact = NULL;
-			return GNOME_Evolution_Addressbook_OtherError;
+			g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, _("Cancelled")));
+			return;
 		}
 
 		if (status == E2K_HTTP_MULTI_STATUS && nresults > 0)
@@ -1860,43 +1873,44 @@ e_book_backend_exchange_modify_contact (EBookBackendSync  *backend,
 			e_book_backend_cache_remove_contact (bepriv->cache, uri);
 			e_book_backend_cache_add_contact (bepriv->cache, *contact);
 			UNLOCK (bepriv);
-			return GNOME_Evolution_Addressbook_Success;
+			return;
 		} else {
 			g_object_unref (*contact);
 			*contact = NULL;
-			return http_status_to_pas (status);
+			http_status_to_error (status, perror);
+			return;
 		}
 
 	default:
 		break;
 	}
-	return GNOME_Evolution_Addressbook_Success;
 }
 
-static EBookBackendSyncStatus
+static void
 e_book_backend_exchange_remove_contacts (EBookBackendSync  *backend,
 					 EDataBook         *book,
 					 guint32	   opid,
 					 GList             *id_list,
-					 GList            **removed_ids)
+					 GList            **removed_ids,
+					 GError           **perror)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
 	const gchar *uri;
 	E2kHTTPStatus status;
 	GList *l;
-	EBookBackendSyncStatus ret_status = GNOME_Evolution_Addressbook_Success;
 
 	 /* Remove one or more contacts */
 	d(printf("ebbe_remove_contact(%p, %p, %s)\n", backend, book, (gchar *)id_list->data));
 
 	switch (bepriv->mode) {
 
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+	case E_DATA_BOOK_MODE_LOCAL:
 		*removed_ids = NULL;
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+		g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
+	case E_DATA_BOOK_MODE_REMOTE:
 
 		for (l = id_list; l; l = l->next) {
 			uri = l->data;
@@ -1910,14 +1924,13 @@ e_book_backend_exchange_remove_contacts (EBookBackendSync  *backend,
 						*removed_ids, g_strdup (uri));
 				UNLOCK (bepriv);
 			} else
-				ret_status = http_status_to_pas (status);
+				http_status_to_error (status, perror);
 		}
-		return ret_status;
+		return;
 
 	default:
 		break;
 	}
-	return GNOME_Evolution_Addressbook_Success;
 }
 
 static ESExpResult *
@@ -2187,12 +2200,13 @@ subscription_notify (E2kContext *ctx, const gchar *uri,
 	g_object_unref (be);
 }
 
-static EBookBackendSyncStatus
+static void
 e_book_backend_exchange_get_contact_list (EBookBackendSync  *backend,
 					  EDataBook         *book,
 					  guint32	     opid,
-					  const gchar        *query,
-					  GList            **contacts)
+					  const gchar       *query,
+					  GList            **contacts,
+					  GError           **perror)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
@@ -2208,7 +2222,7 @@ e_book_backend_exchange_get_contact_list (EBookBackendSync  *backend,
 
 	switch (bepriv->mode) {
 
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+	case E_DATA_BOOK_MODE_LOCAL:
 		/* FIXME */
 		offline_contacts = e_book_backend_cache_get_contacts (bepriv->cache,
 							      query);
@@ -2226,15 +2240,17 @@ e_book_backend_exchange_get_contact_list (EBookBackendSync  *backend,
 		*contacts = vcard_list;
 		if (temp)
 			g_list_free (temp);
-		return GNOME_Evolution_Addressbook_Success;
+		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
+	case E_DATA_BOOK_MODE_REMOTE:
 
 		rn = e_book_backend_exchange_build_restriction (query,
 								bepriv->base_rn);
 
-		if (!rn)
-			return GNOME_Evolution_Addressbook_OtherError;
+		if (!rn) {
+			g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "Failed to build restriction"));
+			return;
+		}
 
 		iter = e_folder_exchange_search_start (bepriv->folder, NULL,
 					       field_names, n_field_names,
@@ -2274,12 +2290,12 @@ e_book_backend_exchange_get_contact_list (EBookBackendSync  *backend,
 		if (sexp)
 			g_object_unref (sexp);
 
-		return http_status_to_pas (status);
+		http_status_to_error (status, perror);
+		return;
 
 	default:
 		break;
 	}
-	return GNOME_Evolution_Addressbook_Success;
 }
 
 static void
@@ -2295,6 +2311,7 @@ e_book_backend_exchange_start_book_view (EBookBackend  *backend,
 	E2kHTTPStatus status;
 	EContact *contact;
 	GList *temp_list, *contacts;
+	GError *err = NULL;
 
 	d(printf("ebbe_start_book_view(%p, %p)\n", backend, book_view));
 
@@ -2303,15 +2320,15 @@ e_book_backend_exchange_start_book_view (EBookBackend  *backend,
 
 	switch (bepriv->mode) {
 
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+	case E_DATA_BOOK_MODE_LOCAL:
 		if (!bepriv->marked_for_offline) {
-			e_data_book_view_notify_complete (book_view,
-					GNOME_Evolution_Addressbook_OfflineUnavailable);
+			err = EDB_ERROR (OFFLINE_UNAVAILABLE);
+			e_data_book_view_notify_complete (book_view, err);
+			g_error_free (err);
 			return;
 		}
 		if (!bepriv->cache) {
-			e_data_book_view_notify_complete (book_view,
-					GNOME_Evolution_Addressbook_Success);
+			e_data_book_view_notify_complete (book_view, NULL);
 			return;
 		}
 		contacts = e_book_backend_cache_get_contacts (bepriv->cache,
@@ -2335,19 +2352,20 @@ e_book_backend_exchange_start_book_view (EBookBackend  *backend,
 			g_object_unref (contacts->data);
 		}
 		//if (!stopped)
-		e_data_book_view_notify_complete (book_view,
-					GNOME_Evolution_Addressbook_Success);
+		e_data_book_view_notify_complete (book_view, NULL);
 		if (temp_list)
 			 g_list_free (temp_list);
 		e_data_book_view_unref (book_view);
 		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
+	case E_DATA_BOOK_MODE_REMOTE:
 
 		if (!be->priv->ctx) {
+			err = EDB_ERROR (AUTHENTICATION_REQUIRED);
 			e_book_backend_notify_auth_required (backend);
-			e_data_book_view_notify_complete (book_view, GNOME_Evolution_Addressbook_AuthenticationRequired);
+			e_data_book_view_notify_complete (book_view, err);
 			e_data_book_view_unref (book_view);
+			g_error_free (err);
 			return;
 		}
 
@@ -2375,8 +2393,11 @@ e_book_backend_exchange_start_book_view (EBookBackend  *backend,
 		}
 		status = e2k_result_iter_free (iter);
 
-		e_data_book_view_notify_complete (book_view, http_status_to_pas (status));
+		http_status_to_error (status, &err);
+		e_data_book_view_notify_complete (book_view, err);
 		e_data_book_view_unref (book_view);
+		if (err)
+			g_error_free (err);
 
 		/* also update the folder list */
 		exchange_account_rescan_tree (bepriv->account);
@@ -2445,12 +2466,13 @@ find_deleted_ids (const gchar *id, const gchar *vcard, gpointer user_data)
 	return remove;
 }
 
-static EBookBackendSyncStatus
+static void
 e_book_backend_exchange_get_changes (EBookBackendSync  *backend,
 				     EDataBook         *book,
 				     guint32		opid,
 				     const gchar        *change_id,
-				     GList            **changes)
+				     GList            **changes,
+				     GError           **perror)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
@@ -2464,11 +2486,12 @@ e_book_backend_exchange_get_changes (EBookBackendSync  *backend,
 
 	switch (bepriv->mode) {
 
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+	case E_DATA_BOOK_MODE_LOCAL:
 		*changes = NULL;
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+		g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
+	case E_DATA_BOOK_MODE_REMOTE:
 
 		ctx = g_new0 (EBookBackendExchangeChangeContext, 1);
 		ctx->seen_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -2537,20 +2560,21 @@ e_book_backend_exchange_get_changes (EBookBackendSync  *backend,
 		g_hash_table_destroy (ctx->seen_ids);
 		g_free (ctx);
 
-		return http_status_to_pas (status);
+		http_status_to_error (status, perror);
+		return;
 
 	default:
 		break;
 	}
-	return GNOME_Evolution_Addressbook_Success;
 }
 
-static EBookBackendSyncStatus
+static void
 e_book_backend_exchange_get_contact (EBookBackendSync  *backend,
 				     EDataBook         *book,
 				     guint32            opid,
 				     const gchar        *id,
-				     gchar             **vcard)
+				     gchar             **vcard,
+				     GError            **perror)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
@@ -2565,21 +2589,22 @@ e_book_backend_exchange_get_contact (EBookBackendSync  *backend,
 
 	switch (bepriv->mode) {
 
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+	case E_DATA_BOOK_MODE_LOCAL:
 		contact = e_book_backend_cache_get_contact (bepriv->cache,
 							    id);
 		if (contact) {
 			*vcard =  e_vcard_to_string (E_VCARD (contact),
 						     EVC_FORMAT_VCARD_30);
 			g_object_unref (contact);
-			return GNOME_Evolution_Addressbook_Success;
+			return;
 		}
 		else {
 			*vcard = g_strdup ("");
-			return GNOME_Evolution_Addressbook_ContactNotFound;
+			g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
+			return;
 		}
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
+	case E_DATA_BOOK_MODE_REMOTE:
 
 		if (bepriv->marked_for_offline && e_book_backend_cache_is_populated (bepriv->cache)) {
 			contact = e_book_backend_cache_get_contact (bepriv->cache,
@@ -2588,11 +2613,12 @@ e_book_backend_exchange_get_contact (EBookBackendSync  *backend,
 				*vcard =  e_vcard_to_string (E_VCARD (contact),
 							     EVC_FORMAT_VCARD_30);
 				g_object_unref (contact);
-				return GNOME_Evolution_Addressbook_Success;
+				return;
 			}
 			else {
 				*vcard = g_strdup ("");
-				return GNOME_Evolution_Addressbook_ContactNotFound;
+				g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
+				return;
 			}
 
 		} else {
@@ -2603,7 +2629,8 @@ e_book_backend_exchange_get_contact (EBookBackendSync  *backend,
 			if (!uri->protocol ||  !*uri->protocol) {
 				e2k_uri_free (uri);
 				*vcard = g_strdup ("");
-				return GNOME_Evolution_Addressbook_ContactNotFound;
+				g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
+				return;
 			}
 			e2k_uri_free (uri);
 
@@ -2611,8 +2638,10 @@ e_book_backend_exchange_get_contact (EBookBackendSync  *backend,
 						       field_names, n_field_names,
 						       &results, &nresults);
 
-			if (status == E2K_HTTP_CANCELLED)
-				return GNOME_Evolution_Addressbook_OtherError;
+			if (status == E2K_HTTP_CANCELLED) {
+				g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, _("Cancelled")));
+				return;
+			}
 
 			if (status == E2K_HTTP_MULTI_STATUS && nresults > 0) {
 				contact = e_contact_from_props (be, &results[0]);
@@ -2621,12 +2650,13 @@ e_book_backend_exchange_get_contact (EBookBackendSync  *backend,
 				g_object_unref (contact);
 				e2k_results_free (results, nresults);
 
-				return GNOME_Evolution_Addressbook_Success;
+				return;
 
 			} else {
 				*vcard = g_strdup ("");
 
-				return GNOME_Evolution_Addressbook_ContactNotFound;
+				g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
+				return;
 			}
 		}
 
@@ -2634,7 +2664,7 @@ e_book_backend_exchange_get_contact (EBookBackendSync  *backend,
 		break;
 	}
 
-	return GNOME_Evolution_Addressbook_OtherError;
+	g_propagate_error (perror, EDB_ERROR (OTHER_ERROR));
 }
 
 static void
@@ -2654,25 +2684,25 @@ e_book_backend_exchange_authenticate_user (EBookBackend *backend,
 
 	switch (bepriv->mode) {
 
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+	case E_DATA_BOOK_MODE_LOCAL:
 		e_book_backend_notify_writable (E_BOOK_BACKEND (backend), FALSE);
 		e_book_backend_notify_connection_status (E_BOOK_BACKEND (backend), FALSE);
-		e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_Success);
+		e_data_book_respond_authenticate_user (book, opid, NULL);
 		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
+	case E_DATA_BOOK_MODE_REMOTE:
 
 		bepriv->account = account = exchange_share_config_listener_get_account_for_uri (NULL, bepriv->exchange_uri);
 		/* FIXME : Check for failures */
 		if (!(bepriv->ctx = exchange_account_get_context (account))) {
 			exchange_account_set_online (account);
 			if (!exchange_account_connect (account, password, &result)) {
-				e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_AuthenticationFailed);
+				e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (AUTHENTICATION_FAILED));
 				return;
 			}
 		}
 		if (!bepriv->connected)
-			e_book_backend_exchange_connect (be);
+			e_book_backend_exchange_connect (be, NULL);
 		if (e_book_backend_cache_is_populated (bepriv->cache)) {
 			if (bepriv->is_writable)
 				g_thread_create ((GThreadFunc) update_cache,
@@ -2682,14 +2712,13 @@ e_book_backend_exchange_authenticate_user (EBookBackend *backend,
 			/* for personal books we always cache*/
 			g_thread_create ((GThreadFunc) build_cache, be, FALSE, NULL);
 		}
-		e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_Success);
+		e_data_book_respond_authenticate_user (book, opid, NULL);
 		return;
 
 	default:
 		break;
 	}
-	e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_Success);
-	return;
+	e_data_book_respond_authenticate_user (book, opid, NULL);
 }
 
 static void
@@ -2705,18 +2734,19 @@ e_book_backend_exchange_get_supported_auth_methods (EBookBackend *backend,
 	auth_method = g_strdup_printf ("plain/password");
 	auth_methods = g_list_append (auth_methods, auth_method);
 	e_data_book_respond_get_supported_auth_methods (book, opid,
-				GNOME_Evolution_Addressbook_Success,
+				NULL,
 				auth_methods);
 
 	g_free (auth_method);
 	g_list_free (auth_methods);
 }
 
-static EBookBackendSyncStatus
+static void
 e_book_backend_exchange_get_supported_fields (EBookBackendSync  *backend,
 					      EDataBook         *book,
 					      guint32		 opid,
-					      GList            **methods)
+					      GList            **methods,
+					      GError           **perror)
 {
 	gint i;
 
@@ -2729,26 +2759,24 @@ e_book_backend_exchange_get_supported_fields (EBookBackendSync  *backend,
 					g_strdup (e_contact_field_name(prop_mappings[i].field)));
 		}
 	}
-
-	return GNOME_Evolution_Addressbook_Success;
 }
 
-static EBookBackendSyncStatus
+static void
 e_book_backend_exchange_get_required_fields (EBookBackendSync *backend,
 					  EDataBook *book,
 					  guint32 opid,
-					  GList **fields_out)
+					  GList **fields_out,
+					  GError **perror)
 {
 	GList *fields = NULL;
 
 	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_FILE_AS)));
 	*fields_out = fields;
-	return GNOME_Evolution_Addressbook_Success;
 
 }
 
-static GNOME_Evolution_Addressbook_CallStatus
-e_book_backend_exchange_cancel_operation (EBookBackend *backend, EDataBook *book)
+static void
+e_book_backend_exchange_cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
@@ -2759,21 +2787,22 @@ e_book_backend_exchange_cancel_operation (EBookBackend *backend, EDataBook *book
 	op = g_hash_table_lookup (bepriv->ops, book);
 	if (op) {
 		e2k_operation_cancel (op);
-		return GNOME_Evolution_Addressbook_Success;
-	} else
-		return GNOME_Evolution_Addressbook_CouldNotCancel;
+	} else {
+		g_propagate_error (perror, EDB_ERROR (COULD_NOT_CANCEL));
+	}
 }
 
-static GNOME_Evolution_Addressbook_CallStatus
+static void
 e_book_backend_exchange_load_source (EBookBackend *backend,
 				     ESource      *source,
-				     gboolean      only_if_exists)
+				     gboolean      only_if_exists,
+				     GError      **error)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
 	const gchar *offline;
 
-	g_return_val_if_fail (bepriv->connected == FALSE, GNOME_Evolution_Addressbook_OtherError);
+	e_return_data_book_error_if_fail (bepriv->connected == FALSE, E_DATA_BOOK_STATUS_OTHER_ERROR);
 
 	d(printf("ebbe_load_source(%p, %p[%s])\n", backend, source, e_source_peek_name (source)));
 
@@ -2781,40 +2810,43 @@ e_book_backend_exchange_load_source (EBookBackend *backend,
 	if (offline  && g_str_equal (offline, "1"))
 		bepriv->marked_for_offline = TRUE;
 
-	if (bepriv->mode ==  GNOME_Evolution_Addressbook_MODE_LOCAL &&
+	if (bepriv->mode ==  E_DATA_BOOK_MODE_LOCAL &&
 	    !bepriv->marked_for_offline ) {
-		return GNOME_Evolution_Addressbook_OfflineUnavailable;
+		g_propagate_error (error, EDB_ERROR (OFFLINE_UNAVAILABLE));
+		return;
 	}
 
 	bepriv->exchange_uri = e_source_get_uri (source);
-	if (bepriv->exchange_uri == NULL)
-		return  GNOME_Evolution_Addressbook_OtherError;
+	if (bepriv->exchange_uri == NULL) {
+		g_propagate_error (error, EDB_ERROR_EX (OTHER_ERROR, "Cannot get source's URI"));
+		return;
+	}
 	bepriv->original_uri = g_strdup (bepriv->exchange_uri);
 
-	if (bepriv->mode == GNOME_Evolution_Addressbook_MODE_LOCAL) {
+	if (bepriv->mode == E_DATA_BOOK_MODE_LOCAL) {
 		e_book_backend_set_is_writable (backend, FALSE);
 		e_book_backend_notify_writable (backend, FALSE);
 		e_book_backend_notify_connection_status (backend, FALSE);
-		if (!e_book_backend_cache_exists (bepriv->original_uri))
-			return GNOME_Evolution_Addressbook_OfflineUnavailable;
+		if (!e_book_backend_cache_exists (bepriv->original_uri)) {
+			g_propagate_error (error, EDB_ERROR (OFFLINE_UNAVAILABLE));
+			return;
+		}
 	}
 	bepriv->cache = e_book_backend_cache_new (bepriv->original_uri);
 
 	/* Once aunthentication in address book works this can be removed */
-	if (bepriv->mode == GNOME_Evolution_Addressbook_MODE_LOCAL) {
-		return GNOME_Evolution_Addressbook_Success;
+	if (bepriv->mode == E_DATA_BOOK_MODE_LOCAL) {
+		return;
 	}
 
 	// writable property will be set in authenticate_user callback
 	e_book_backend_set_is_writable (E_BOOK_BACKEND(backend), FALSE);
 	e_book_backend_set_is_loaded (E_BOOK_BACKEND (be), TRUE);
 	e_book_backend_notify_connection_status (E_BOOK_BACKEND (be), TRUE);
-
-	return GNOME_Evolution_Addressbook_Success;
 }
 
-static EBookBackendSyncStatus
-e_book_backend_exchange_remove (EBookBackendSync *backend, EDataBook *book, guint32 opid)
+static void
+e_book_backend_exchange_remove (EBookBackendSync *backend, EDataBook *book, guint32 opid, GError **perror)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
@@ -2838,17 +2870,17 @@ e_book_backend_exchange_remove (EBookBackendSync *backend, EDataBook *book, guin
 		}
 	}
 	if (result == EXCHANGE_ACCOUNT_FOLDER_OK)
-		return GNOME_Evolution_Addressbook_Success;
+		return;
 	else if (result == EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST)
-		return GNOME_Evolution_Addressbook_NoSuchBook;
+		g_propagate_error (perror, EDB_ERROR (NO_SUCH_BOOK));
 	else if (result == EXCHANGE_ACCOUNT_FOLDER_UNSUPPORTED_OPERATION)
-		return GNOME_Evolution_Addressbook_PermissionDenied;
+		g_propagate_error (perror, EDB_ERROR (PERMISSION_DENIED));
 	else if (result == EXCHANGE_ACCOUNT_FOLDER_OFFLINE)
-		return GNOME_Evolution_Addressbook_OfflineUnavailable;
+		g_propagate_error (perror, EDB_ERROR (OFFLINE_UNAVAILABLE));
 	else if (result == EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED)
-		return GNOME_Evolution_Addressbook_PermissionDenied;
+		g_propagate_error (perror, EDB_ERROR (PERMISSION_DENIED));
 	else
-		return GNOME_Evolution_Addressbook_OtherError;
+		g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Failed with result code %d", result));
 }
 
 static gchar *
@@ -2871,7 +2903,7 @@ e_book_backend_exchange_construct (EBookBackendExchange *backend)
 
 static void
 e_book_backend_exchange_set_mode (EBookBackend *backend,
-                                  GNOME_Evolution_Addressbook_BookMode mode)
+                                  EDataBookMode mode)
 {
 	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
 	EBookBackendExchangePrivate *bepriv = be->priv;
@@ -2879,12 +2911,12 @@ e_book_backend_exchange_set_mode (EBookBackend *backend,
 
 	bepriv->mode = mode;
 	/* if (e_book_backend_is_loaded (backend)) { */
-	if (mode == GNOME_Evolution_Addressbook_MODE_LOCAL) {
+	if (mode == E_DATA_BOOK_MODE_LOCAL) {
 		e_book_backend_set_is_writable (backend, FALSE);
 		e_book_backend_notify_writable (backend, FALSE);
 		e_book_backend_notify_connection_status (backend, FALSE);
 		/* FIXME : free context ? */
-	} else if (mode == GNOME_Evolution_Addressbook_MODE_REMOTE) {
+	} else if (mode == E_DATA_BOOK_MODE_REMOTE) {
 		e_book_backend_set_is_writable (backend, bepriv->is_writable);
 		e_book_backend_notify_writable (backend, bepriv->is_writable);
 		e_book_backend_notify_connection_status (backend, TRUE);
diff --git a/addressbook/e-book-backend-gal.c b/addressbook/e-book-backend-gal.c
index 20c8079..9904eb0 100644
--- a/addressbook/e-book-backend-gal.c
+++ b/addressbook/e-book-backend-gal.c
@@ -64,7 +64,7 @@
 #define ENABLE_CACHE 0
 #endif
 
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 #include  "e-book-backend-db-cache.h"
 #include "db.h"
 #endif
@@ -78,7 +78,11 @@
 #define TV_TO_MILLIS(timeval) ((timeval).tv_sec * 1000 + (timeval).tv_usec / 1000)
 
 static const gchar *query_prop_to_ldap (const gchar *query_prop);
-static gint build_query (EBookBackendGAL *bl, const gchar *query, const gchar *ldap_filter, gchar **ldap_query);
+static void build_query (EBookBackendGAL *bl, const gchar *query, const gchar *ldap_filter, gchar **ldap_query, GError **perror);
+
+#define EDB_ERROR(_code) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, NULL)
+#define EDB_ERROR_EX(_code, _msg) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, _msg)
+#define EDB_ERROR_MSG_TYPE(_msg_type) e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_INVALID_ARG, "Incorrect msg type %d passed to %s", _msg_type, G_STRFUNC)
 
 #define PARENT_TYPE E_TYPE_BOOK_BACKEND
 static EBookBackendClass *parent_class;
@@ -105,7 +109,7 @@ struct _EBookBackendGALPrivate {
 	gint active_ops;
 	gint mode;
 	gint poll_timeout;
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 	DB *file_db;
 	DB_ENV *env;
 	time_t last_best_time;
@@ -118,7 +122,7 @@ struct _EBookBackendGALPrivate {
 };
 
 #define SUMMARY_FLUSH_TIMEOUT 5000
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 static GStaticMutex global_env_lock = G_STATIC_MUTEX_INIT;
 static struct {
 	gint ref_count;
@@ -266,8 +270,8 @@ find_book_view (EBookBackendGAL *bl)
 	return rv;
 }
 
-static GNOME_Evolution_Addressbook_CallStatus
-gal_connect (EBookBackendGAL *bl)
+static gboolean
+gal_connect (EBookBackendGAL *bl, GError **perror)
 {
 	EBookBackendGALPrivate *blpriv = bl->priv;
 	gint ldap_error = 0;
@@ -283,11 +287,15 @@ gal_connect (EBookBackendGAL *bl)
 	blpriv->connected = FALSE;
 
 	blpriv->account = exchange_share_config_listener_get_account_for_uri (NULL, blpriv->gal_uri);
-	if (!blpriv->account)
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+	if (!blpriv->account) {
+		g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+		return FALSE;
+	}
 	blpriv->gc = exchange_account_get_global_catalog (blpriv->account);
-	if (!blpriv->gc)
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+	if (!blpriv->gc) {
+		g_propagate_error (perror, EDB_ERROR (REPOSITORY_OFFLINE));
+		return FALSE;
+	}
 
 	g_object_ref (blpriv->gc);
 	g_mutex_lock (blpriv->ldap_lock);
@@ -295,16 +303,19 @@ gal_connect (EBookBackendGAL *bl)
 	if (!blpriv->ldap) {
 		g_mutex_unlock (blpriv->ldap_lock);
 		d(printf ("%s: Cannot get ldap, error 0x%x (%s)\n", G_STRFUNC, ldap_error, ldap_err2string (ldap_error) ? ldap_err2string (ldap_error) : "Unknown error"));
-		if (ldap_error == LDAP_AUTH_METHOD_NOT_SUPPORTED)
-			return GNOME_Evolution_Addressbook_UnsupportedAuthenticationMethod;
+		if (ldap_error == LDAP_AUTH_METHOD_NOT_SUPPORTED) {
+			g_propagate_error (perror, EDB_ERROR (UNSUPPORTED_AUTHENTICATION_METHOD));
+		} else {
+			g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_REPOSITORY_OFFLINE, "Cannot get ldap, error 0x%x (%s)", ldap_error, ldap_err2string (ldap_error) ? ldap_err2string (ldap_error) : "Unknown error"));
+		}
 
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+		return FALSE;
 	}
 	g_mutex_unlock (blpriv->ldap_lock);
 
 	blpriv->connected = TRUE;
 	e_book_backend_set_is_loaded (E_BOOK_BACKEND (bl), TRUE);
-	return GNOME_Evolution_Addressbook_Success;
+	return TRUE;
 }
 
 static gboolean
@@ -422,21 +433,21 @@ ldap_op_finished (LDAPOp *op)
 	g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
 }
 
-static gint
+static GError *
 ldap_error_to_response (gint ldap_error)
 {
 	if (ldap_error == LDAP_SUCCESS)
-		return GNOME_Evolution_Addressbook_Success;
+		return NULL;
 	else if (LDAP_NAME_ERROR (ldap_error))
-		return GNOME_Evolution_Addressbook_ContactNotFound;
+		return EDB_ERROR (CONTACT_NOT_FOUND);
 	else if (ldap_error == LDAP_INSUFFICIENT_ACCESS)
-		return GNOME_Evolution_Addressbook_PermissionDenied;
+		return EDB_ERROR (PERMISSION_DENIED);
 	else if (ldap_error == LDAP_SERVER_DOWN)
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+		return EDB_ERROR (REPOSITORY_OFFLINE);
 	else if (ldap_error == LDAP_ALREADY_EXISTS)
-		return GNOME_Evolution_Addressbook_ContactIdAlreadyExists;
-	else
-		return GNOME_Evolution_Addressbook_OtherError;
+		return EDB_ERROR (CONTACTID_ALREADY_EXISTS);
+
+	return e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Failed with ldap error 0x%x (%s)", ldap_error, ldap_err2string (ldap_error) ? ldap_err2string (ldap_error) : "Unknown error");
 }
 
 
@@ -448,7 +459,7 @@ create_contact (EBookBackend *backend,
 		const gchar   *vcard)
 {
 	e_data_book_respond_create (book, opid,
-				    GNOME_Evolution_Addressbook_PermissionDenied,
+				    EDB_ERROR (PERMISSION_DENIED),
 				    NULL);
 }
 
@@ -459,7 +470,7 @@ remove_contacts (EBookBackend *backend,
 		 GList        *ids)
 {
 	e_data_book_respond_remove_contacts (book, opid,
-					     GNOME_Evolution_Addressbook_PermissionDenied,
+					     EDB_ERROR (PERMISSION_DENIED),
 					     NULL);
 }
 
@@ -470,7 +481,7 @@ modify_contact (EBookBackend *backend,
 		const gchar   *vcard)
 {
 	e_data_book_respond_modify (book, opid,
-				    GNOME_Evolution_Addressbook_PermissionDenied,
+				    EDB_ERROR (PERMISSION_DENIED),
 				    NULL);
 }
 
@@ -488,7 +499,7 @@ get_contact_handler (LDAPOp *op, LDAPMessage *res)
 	if (!bl->priv->ldap) {
 		g_mutex_unlock (bl->priv->ldap_lock);
 		e_data_book_respond_get_contact (op->book, op->opid,
-					GNOME_Evolution_Addressbook_OtherError, "");
+					EDB_ERROR_EX (OTHER_ERROR, "Not connected"), "");
 		ldap_op_finished (op);
 		return;
 	}
@@ -511,7 +522,7 @@ get_contact_handler (LDAPOp *op, LDAPMessage *res)
 			g_warning ("uh, this shouldn't happen");
 			e_data_book_respond_get_contact (op->book,
 							 op->opid,
-							 GNOME_Evolution_Addressbook_OtherError,
+							 EDB_ERROR_EX (OTHER_ERROR, "ldap_first_entry call failed"),
 							 "");
 			ldap_op_finished (op);
 			return;
@@ -521,7 +532,7 @@ get_contact_handler (LDAPOp *op, LDAPMessage *res)
 		vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
 		e_data_book_respond_get_contact (op->book,
 						 op->opid,
-						 GNOME_Evolution_Addressbook_Success,
+						 NULL /* Success */,
 						 vcard);
 		g_free (vcard);
 		g_object_unref (contact);
@@ -553,7 +564,7 @@ get_contact_handler (LDAPOp *op, LDAPMessage *res)
 		g_warning ("unhandled result type %d returned", msg_type);
 		e_data_book_respond_get_contact (op->book,
 						 op->opid,
-						 GNOME_Evolution_Addressbook_OtherError,
+						 EDB_ERROR_MSG_TYPE (msg_type),
 						 "");
 		ldap_op_finished (op);
 	}
@@ -582,14 +593,14 @@ get_contact (EBookBackend *backend,
 
 	d(printf("get contact\n"));
 	switch (bl->priv->mode) {
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
-#if ENABLE_CACHE
+	case E_DATA_BOOK_MODE_LOCAL:
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		if (bl->priv->marked_for_offline && bl->priv->file_db) {
 			EContact *contact = e_book_backend_db_cache_get_contact (bl->priv->file_db, id);
 			gchar *vcard_str;
 
 			if (!contact) {
-				e_data_book_respond_get_contact (book, opid, GNOME_Evolution_Addressbook_OtherError, "");
+				e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
 				return;
 			}
 
@@ -597,24 +608,24 @@ get_contact (EBookBackend *backend,
 
 			e_data_book_respond_get_contact (book,
 							 opid,
-							 GNOME_Evolution_Addressbook_Success,
+							 NULL /* Success */,
 							 vcard_str);
 			g_free (vcard_str);
 			g_object_unref (contact);
 			return;
 		}
 #endif
-		e_data_book_respond_get_contact(book, opid, GNOME_Evolution_Addressbook_RepositoryOffline, "");
+		e_data_book_respond_get_contact(book, opid, EDB_ERROR (REPOSITORY_OFFLINE), "");
 		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE :
-#if ENABLE_CACHE
+	case E_DATA_BOOK_MODE_REMOTE :
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		d(printf("Mode:Remote\n"));
 		if (bl->priv->marked_for_offline && bl->priv->file_db) {
 			EContact *contact = e_book_backend_db_cache_get_contact (bl->priv->file_db, id);
 			gchar *vcard_str;
 			if (!contact) {
-				e_data_book_respond_get_contact (book, opid, GNOME_Evolution_Addressbook_OtherError, "");
+				e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
 				return;
 			}
 
@@ -622,7 +633,7 @@ get_contact (EBookBackend *backend,
 
 			e_data_book_respond_get_contact (book,
 							 opid,
-							 GNOME_Evolution_Addressbook_Success,
+							 NULL /* Success */,
 							 vcard_str);
 			g_free (vcard_str);
 			g_object_unref (contact);
@@ -633,7 +644,7 @@ get_contact (EBookBackend *backend,
 			g_mutex_lock (bl->priv->ldap_lock);
 			if (!bl->priv->ldap) {
 				g_mutex_unlock (bl->priv->ldap_lock);
-				e_data_book_respond_get_contact (book, opid, GNOME_Evolution_Addressbook_OtherError, "");
+				e_data_book_respond_get_contact (book, opid, EDB_ERROR_EX (OTHER_ERROR, "Not connected"), "");
 				return;
 			}
 			g_mutex_unlock (bl->priv->ldap_lock);
@@ -665,7 +676,7 @@ get_contact (EBookBackend *backend,
 								 "");
 				get_contact_dtor ((LDAPOp*)get_contact_op);
 			}
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		}
 #endif
 	}
@@ -687,7 +698,7 @@ contact_list_handler (LDAPOp *op, LDAPMessage *res)
 	g_mutex_lock (bl->priv->ldap_lock);
 	if (!bl->priv->ldap) {
 		g_mutex_unlock (bl->priv->ldap_lock);
-		e_data_book_respond_get_contact_list (op->book, op->opid, GNOME_Evolution_Addressbook_OtherError, NULL);
+		e_data_book_respond_get_contact_list (op->book, op->opid, EDB_ERROR_EX (OTHER_ERROR, "Not connected"), NULL);
 		ldap_op_finished (op);
 		return;
 	}
@@ -734,22 +745,22 @@ contact_list_handler (LDAPOp *op, LDAPMessage *res)
 		if (ldap_error == LDAP_TIMELIMIT_EXCEEDED)
 			e_data_book_respond_get_contact_list (op->book,
 							      op->opid,
-							      GNOME_Evolution_Addressbook_SearchTimeLimitExceeded,
+							      EDB_ERROR (SEARCH_TIME_LIMIT_EXCEEDED),
 							      contact_list_op->contacts);
 		else if (ldap_error == LDAP_SIZELIMIT_EXCEEDED)
 			e_data_book_respond_get_contact_list (op->book,
 							      op->opid,
-							      GNOME_Evolution_Addressbook_SearchSizeLimitExceeded,
+							      EDB_ERROR (SEARCH_SIZE_LIMIT_EXCEEDED),
 							      contact_list_op->contacts);
 		else if (ldap_error == LDAP_SUCCESS)
 			e_data_book_respond_get_contact_list (op->book,
 							      op->opid,
-							      GNOME_Evolution_Addressbook_Success,
+							      NULL /* Success */,
 							      contact_list_op->contacts);
 		else
 			e_data_book_respond_get_contact_list (op->book,
 							      op->opid,
-							      GNOME_Evolution_Addressbook_OtherError,
+							      ldap_error_to_response (ldap_error),
 							      contact_list_op->contacts);
 
 		ldap_op_finished (op);
@@ -758,7 +769,7 @@ contact_list_handler (LDAPOp *op, LDAPMessage *res)
 		g_warning ("unhandled search result type %d returned", msg_type);
 		e_data_book_respond_get_contact_list (op->book,
 						      op->opid,
-						      GNOME_Evolution_Addressbook_OtherError,
+						      EDB_ERROR_MSG_TYPE (msg_type),
 						      NULL);
 		ldap_op_finished (op);
 	}
@@ -781,16 +792,16 @@ get_contact_list (EBookBackend *backend,
 {
 	LDAPGetContactListOp *contact_list_op;
 	EBookBackendGAL *bl = E_BOOK_BACKEND_GAL (backend);
-	GNOME_Evolution_Addressbook_CallStatus status;
 	gint contact_list_msgid;
 	EDataBookView *book_view;
 	gint ldap_error;
 	gchar *ldap_query;
+	GError *error = NULL;
 
 	d(printf("get contact list\n"));
 	switch (bl->priv->mode) {
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
-#if ENABLE_CACHE
+	case E_DATA_BOOK_MODE_LOCAL:
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		if (bl->priv->marked_for_offline && bl->priv->file_db) {
 			GList *contacts;
 			GList *vcard_strings = NULL;
@@ -806,16 +817,15 @@ get_contact_list (EBookBackend *backend,
 			}
 
 			g_list_free (contacts);
-			e_data_book_respond_get_contact_list (book, opid, GNOME_Evolution_Addressbook_Success, vcard_strings);
+			e_data_book_respond_get_contact_list (book, opid, NULL /* Success */, vcard_strings);
 			return;
 		}
 #endif
-		e_data_book_respond_get_contact_list (book, opid, GNOME_Evolution_Addressbook_RepositoryOffline,
-						      NULL);
+		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
-#if ENABLE_CACHE
+	case E_DATA_BOOK_MODE_REMOTE:
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		d(printf("Mode : Remote\n"));
 		if (bl->priv->marked_for_offline && bl->priv->file_db) {
 			GList *contacts;
@@ -832,7 +842,7 @@ get_contact_list (EBookBackend *backend,
 			}
 
 			g_list_free (contacts);
-			e_data_book_respond_get_contact_list (book, opid, GNOME_Evolution_Addressbook_Success, vcard_strings);
+			e_data_book_respond_get_contact_list (book, opid, NULL /* Success */, vcard_strings);
 			return;
 		}
 		else {
@@ -840,7 +850,7 @@ get_contact_list (EBookBackend *backend,
 			g_mutex_lock (bl->priv->ldap_lock);
 			if (!bl->priv->ldap) {
 				g_mutex_unlock (bl->priv->ldap_lock);
-				e_data_book_respond_get_contact_list (book, opid, GNOME_Evolution_Addressbook_OtherError, NULL);
+				e_data_book_respond_get_contact_list (book, opid, EDB_ERROR_EX (OTHER_ERROR, "Not connected"), NULL);
 				return;
 			}
 			g_mutex_unlock (bl->priv->ldap_lock);
@@ -848,9 +858,9 @@ get_contact_list (EBookBackend *backend,
 			contact_list_op = g_new0 (LDAPGetContactListOp, 1);
 			book_view = find_book_view (bl);
 
-			status = build_query (bl, query, NULL, &ldap_query);
-			if (status != GNOME_Evolution_Addressbook_Success || !ldap_query) {
-				e_data_book_respond_get_contact_list (book, opid, status, NULL);
+			build_query (bl, query, NULL, &ldap_query, &error);
+			if (error || !ldap_query) {
+				e_data_book_respond_get_contact_list (book, opid, error, NULL);
 				return;
 			}
 
@@ -881,7 +891,7 @@ get_contact_list (EBookBackend *backend,
 								      NULL);
 				contact_list_dtor ((LDAPOp*)contact_list_op);
 			}
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		}
 #endif
 	}
@@ -1192,12 +1202,12 @@ static struct {
 	{ "endswith", func_endswith },
 };
 
-static gint
-build_query (EBookBackendGAL *bl, const gchar *query, const gchar *ldap_filter, gchar **ldap_query)
+static void
+build_query (EBookBackendGAL *bl, const gchar *query, const gchar *ldap_filter, gchar **ldap_query, GError **perror)
 {
 	ESExp *sexp;
 	ESExpResult *r;
-	gint i, retval;
+	gint i;
 
 	sexp = e_sexp_new();
 
@@ -1214,7 +1224,8 @@ build_query (EBookBackendGAL *bl, const gchar *query, const gchar *ldap_filter,
 		/* Bad query or it isn't supported */
 		*ldap_query = NULL;
 		e_sexp_unref (sexp);
-		return GNOME_Evolution_Addressbook_QueryRefused;
+		g_propagate_error (perror, EDB_ERROR (QUERY_REFUSED));
+		return;
 	}
 
 	if (r->type == ESEXP_RES_STRING) {
@@ -1223,7 +1234,7 @@ build_query (EBookBackendGAL *bl, const gchar *query, const gchar *ldap_filter,
 			 * don't search for all the contats
 			 */
 			*ldap_query = NULL;
-			retval = GNOME_Evolution_Addressbook_QueryRefused;
+			g_propagate_error (perror, EDB_ERROR (QUERY_REFUSED));
 		}
 		else {
 			gchar *addfilter = NULL;
@@ -1232,7 +1243,6 @@ build_query (EBookBackendGAL *bl, const gchar *query, const gchar *ldap_filter,
 				addfilter = g_strdup_printf ("(%s)", ldap_filter);
 
 			*ldap_query = g_strdup_printf ("(&(mail=*)(!(msExchHideFromAddressLists=TRUE))%s%s)", addfilter ? addfilter : "", r->value.string);
-			retval = GNOME_Evolution_Addressbook_Success;
 		}
 	} else if (r->type == ESEXP_RES_BOOL) {
 		/* If it's FALSE, that means "no matches". If it's TRUE
@@ -1240,17 +1250,14 @@ build_query (EBookBackendGAL *bl, const gchar *query, const gchar *ldap_filter,
 		 * that, so it also means "no matches".
 		 */
 		*ldap_query = NULL;
-		retval = GNOME_Evolution_Addressbook_Success;
 	} else {
 		/* Bad query */
 		*ldap_query = NULL;
-		retval = GNOME_Evolution_Addressbook_QueryRefused;
+		g_propagate_error (perror, EDB_ERROR (QUERY_REFUSED));
 	}
 
 	e_sexp_result_free(sexp, r);
 	e_sexp_unref (sexp);
-
-	return retval;
 }
 
 static void
@@ -1368,7 +1375,7 @@ last_mod_time_populate (EContact *contact, gchar **values,
 	if (time_str)
 		e_contact_set (contact, E_CONTACT_REV, time_str);
 
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 	d(printf("%s: %d %d: %s\n", values[0], bl->priv->last_best_time, mtime, ctime(&mtime)));
 	if (bl->priv->last_best_time < mtime)
 		bl->priv->last_best_time = mtime;
@@ -1643,6 +1650,7 @@ ldap_search_handler (LDAPOp *op, LDAPMessage *res)
 	EDataBookView *view = search_op->view;
 	EBookBackendGAL *bl = E_BOOK_BACKEND_GAL (op->backend);
 	LDAPMessage *e;
+	GError *error = NULL;
 	gint msg_type;
 
 	d(printf ("ldap_search_handler (%p)\n", view));
@@ -1650,7 +1658,9 @@ ldap_search_handler (LDAPOp *op, LDAPMessage *res)
 	if (!bl->priv->ldap) {
 		g_mutex_unlock (bl->priv->ldap_lock);
 		d(printf("%s:%s: other error\n", G_STRLOC, G_STRFUNC));
-		e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_OtherError);
+		error = EDB_ERROR_EX (OTHER_ERROR, "Not connected");
+		e_data_book_view_notify_complete (view, error);
+		g_error_free (error);
 		ldap_op_finished (op);
 		return;
 	}
@@ -1696,20 +1706,26 @@ ldap_search_handler (LDAPOp *op, LDAPMessage *res)
 
 		if ((ldap_error == LDAP_TIMELIMIT_EXCEEDED || ldap_error == LDAP_SIZELIMIT_EXCEEDED) && can_browse ((EBookBackend *)bl))
 			/* do not complain when search limit exceeded for browsable LDAPs */
-			e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_Success);
+			error = NULL;
 		else if (ldap_error == LDAP_TIMELIMIT_EXCEEDED)
-			e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_SearchTimeLimitExceeded);
+			error = EDB_ERROR (SEARCH_TIME_LIMIT_EXCEEDED);
 		else if (ldap_error == LDAP_SIZELIMIT_EXCEEDED)
-			e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_SearchSizeLimitExceeded);
+			error = EDB_ERROR (SEARCH_SIZE_LIMIT_EXCEEDED);
 		else if (ldap_error == LDAP_SUCCESS)
-			e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_Success);
+			error = NULL;
 		else
-			e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_OtherError);
+			error = ldap_error_to_response (ldap_error);
+
+		e_data_book_view_notify_complete (view, error);
+		if (error)
+			g_error_free (error);
 		ldap_op_finished (op);
 	}
 	else {
 		g_warning ("unhandled search result type %d returned", msg_type);
-		e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_OtherError);
+		error = EDB_ERROR_MSG_TYPE (msg_type);
+		e_data_book_view_notify_complete (view, error);
+		g_error_free (error);
 		ldap_op_finished (op);
 
 	}
@@ -1732,7 +1748,7 @@ ldap_search_dtor (LDAPOp *op)
 		g_free (search_op);
 }
 
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 static void
 get_contacts_from_cache (EBookBackendGAL *ebg,
 			 const gchar *query,
@@ -1752,8 +1768,7 @@ get_contacts_from_cache (EBookBackendGAL *ebg,
 			g_object_unref (contact);
 		}
 	}
-	e_data_book_view_notify_complete (book_view,
-					  GNOME_Evolution_Addressbook_Success);
+	e_data_book_view_notify_complete (book_view, NULL /* Success */);
 }
 #endif
 
@@ -1762,20 +1777,23 @@ start_book_view (EBookBackend  *backend,
 		 EDataBookView *view)
 {
 	EBookBackendGAL *bl = E_BOOK_BACKEND_GAL (backend);
-	GNOME_Evolution_Addressbook_CallStatus status;
-	GList *contacts;
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
+	GList *contacts, *l;
+#endif
 	gchar *ldap_query;
 	gint ldap_err = LDAP_SUCCESS;
 	gint search_msgid;
 	gint view_limit;
-	GList *l;
+	GError *err = NULL;
 
 	d(printf("start book view\n"));
 	switch (bl->priv->mode) {
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
-#if ENABLE_CACHE
+	case E_DATA_BOOK_MODE_LOCAL:
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		if (!(bl->priv->marked_for_offline && bl->priv->file_db)) {
-			e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_RepositoryOffline);
+			err = EDB_ERROR (REPOSITORY_OFFLINE);
+			e_data_book_view_notify_complete (view, err);
+			g_error_free (err);
 			return;
 		}
 
@@ -1790,31 +1808,38 @@ start_book_view (EBookBackend  *backend,
 
 		g_list_free (contacts);
 
-		e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_Success);
+		e_data_book_view_notify_complete (view, NULL /* Success */);
 		return;
 #else
-		e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_RepositoryOffline);
+		err = EDB_ERROR (REPOSITORY_OFFLINE);
+		e_data_book_view_notify_complete (view, err);
+		g_error_free (err);
 		return;
 #endif
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
-#if ENABLE_CACHE
+	case E_DATA_BOOK_MODE_REMOTE:
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		d(printf("Mode:Remote\n"));
 		if (bl->priv->marked_for_offline && bl->priv->file_db) {
 			const gchar *query = e_data_book_view_get_card_query (view);
 			GPtrArray *ids = NULL;
+			err = NULL;
 			d(printf("Marked for offline and cache present\n"));
 
-			status = build_query (bl, e_data_book_view_get_card_query (view), NULL,
-					      &ldap_query);
+			build_query (bl, e_data_book_view_get_card_query (view), NULL, &ldap_query, &err);
 
 			/* search for anything */
-			if (!ldap_query && (status == GNOME_Evolution_Addressbook_QueryRefused || status == GNOME_Evolution_Addressbook_Success) && can_browse ((EBookBackend *)bl)) {
+			if (!ldap_query && (!err || err->code == E_DATA_BOOK_STATUS_QUERY_REFUSED) && can_browse ((EBookBackend *)bl)) {
 				ldap_query = g_strdup ("(mail=*)");
-				status = GNOME_Evolution_Addressbook_Success;
+
+				if (err)
+					g_error_free (err);
+				err = NULL;
 			}
 
-			if (status != GNOME_Evolution_Addressbook_Success || !ldap_query) {
-				e_data_book_view_notify_complete (view, status);
+			if (err || !ldap_query) {
+				e_data_book_view_notify_complete (view, err);
+				if (err)
+					g_error_free (err);
 				if (ldap_query)
 					g_free (ldap_query);
 				return;
@@ -1841,13 +1866,15 @@ start_book_view (EBookBackend  *backend,
 
 			g_list_free (contacts);
 
-			e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_Success);
+			e_data_book_view_notify_complete (view, NULL /* Success */);
 			return;
 		}
 		else {
 #endif
 			if (!bl->priv->connected) {
-				e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_RepositoryOffline);
+				err = EDB_ERROR (REPOSITORY_OFFLINE);
+				e_data_book_view_notify_complete (view, err);
+				g_error_free (err);
 				return;
 			}
 
@@ -1857,8 +1884,9 @@ start_book_view (EBookBackend  *backend,
 				g_mutex_unlock (bl->priv->ldap_lock);
 				if (!gal_reconnect (bl, view, 0)) {
 					d(printf("%s:%s: no ldap :(\n", G_STRLOC, G_STRFUNC));
-					e_data_book_view_notify_complete (view,
-									  GNOME_Evolution_Addressbook_InvalidQuery);
+					err = EDB_ERROR (INVALID_QUERY);
+					e_data_book_view_notify_complete (view, err);
+					g_error_free (err);
 					return;
 				}
 			}
@@ -1875,18 +1903,21 @@ start_book_view (EBookBackend  *backend,
 
 			d(printf ("start_book_view (%p)\n", view));
 
-			status = build_query (bl, e_data_book_view_get_card_query (view), NULL,
-					      &ldap_query);
+			build_query (bl, e_data_book_view_get_card_query (view), NULL, &ldap_query, &err);
 
 			/* search for anything */
-			if (!ldap_query &&  (status == GNOME_Evolution_Addressbook_QueryRefused || status == GNOME_Evolution_Addressbook_Success) && can_browse ((EBookBackend *)bl)) {
+			if (!ldap_query &&  (!err || err->code == E_DATA_BOOK_STATUS_QUERY_REFUSED) && can_browse ((EBookBackend *)bl)) {
 				ldap_query = g_strdup ("(mail=*)");
-				status = GNOME_Evolution_Addressbook_Success;
+				if (err)
+					g_error_free (err);
+				err = NULL;
 			}
 
 			d(printf("%s:%s: %s\n", G_STRLOC, G_STRFUNC, ldap_query ? ldap_query : "No ldap_query produced!"));
-			if (status != GNOME_Evolution_Addressbook_Success || !ldap_query) {
-				e_data_book_view_notify_complete (view, status);
+			if (err || !ldap_query) {
+				e_data_book_view_notify_complete (view, err);
+				if (err)
+					g_error_free (err);
 				if (ldap_query)
 					g_free (ldap_query);
 				d(printf("%s:%s: failure \n", G_STRLOC, G_STRFUNC));
@@ -1946,7 +1977,7 @@ start_book_view (EBookBackend  *backend,
 				d(printf("start_book_view: Setting op %p in book %p\n", op, view));
 				g_object_set_data (G_OBJECT (view), "EBookBackendGAL.BookView::search_op", op);
 			}
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		}
 #endif
 	}
@@ -1978,6 +2009,7 @@ get_changes (EBookBackend *backend,
 	/* FIXME: implement */
 }
 
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 static gint pagedResults = 1;
 static ber_int_t pageSize = 1000;
 static ber_int_t entriesLeft = 0;
@@ -2114,7 +2146,6 @@ parse_page_control(
 	return err;
 }
 
-#if ENABLE_CACHE
 static gint dosearch(
 	EBookBackendGAL *bl,
 	const gchar *base,
@@ -2355,27 +2386,31 @@ authenticate_user (EBookBackend *backend,
 	EBookBackendGALPrivate *bepriv = be->priv;
 	ExchangeAccountResult result;
 	ExchangeAccount *account = NULL;
-	GNOME_Evolution_Addressbook_CallStatus res;
+	GError *err = NULL;
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 	GConfClient *gc = gconf_client_get_default();
 	gint interval = gconf_client_get_int (gc, "/apps/evolution/addressbook/gal_cache_interval", NULL);
 
+	g_object_unref (gc);
+#endif
+
 	/* We should not be here */
 /*	e_data_book_respond_authenticate_user (book, */
 /*					       opid, */
-/*					       GNOME_Evolution_Addressbook_UnsupportedAuthenticationMethod); */
+/*					       EDB_ERROR (UNSUPPORTED_AUTHENTICATION_METHOD)); */
 /*	return; */
 
 	d(printf("authenticate_user(%p, %p, %s, %s, %s)\n", backend, book, user, password, auth_method));
 
 	switch (bepriv->mode) {
 
-	case GNOME_Evolution_Addressbook_MODE_LOCAL:
+	case E_DATA_BOOK_MODE_LOCAL:
 		e_book_backend_notify_writable (E_BOOK_BACKEND (backend), FALSE);
 		e_book_backend_notify_connection_status (E_BOOK_BACKEND (backend), FALSE);
-		e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_Success);
+		e_data_book_respond_authenticate_user (book, opid, NULL /* Success */);
 		return;
 
-	case GNOME_Evolution_Addressbook_MODE_REMOTE:
+	case E_DATA_BOOK_MODE_REMOTE:
 
 		account = exchange_share_config_listener_get_account_for_uri (NULL, bepriv->gal_uri);
 		/* FIXME : Check for failures */
@@ -2383,17 +2418,16 @@ authenticate_user (EBookBackend *backend,
 			exchange_account_set_online (account);
 			if (!exchange_account_connect (account, password, &result)) {
 				d(printf("%s:%s: failed\n", G_STRLOC, G_STRFUNC));
-				e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_AuthenticationFailed);
+				e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (AUTHENTICATION_FAILED));
 				return;
 			}
 		}
 
-		res = gal_connect (be);
-		if (res != GNOME_Evolution_Addressbook_Success) {
-			e_data_book_respond_authenticate_user (book, opid, res);
+		if (!gal_connect (be, &err)) {
+			e_data_book_respond_authenticate_user (book, opid, err);
 			return;
 		}
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		if (be->priv->marked_for_offline) {
 			if (e_book_backend_db_cache_is_populated (be->priv->file_db) ) {
 				time_t t1, t2;
@@ -2421,7 +2455,7 @@ authenticate_user (EBookBackend *backend,
 			}
 		}
 #endif
-		e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_Success);
+		e_data_book_respond_authenticate_user (book, opid, NULL /* Success*/ );
 		return;
 
 	default:
@@ -2431,7 +2465,7 @@ authenticate_user (EBookBackend *backend,
 	/* We should not be here */
 	e_data_book_respond_authenticate_user (book,
 					       opid,
-					       GNOME_Evolution_Addressbook_UnsupportedAuthenticationMethod);
+					       EDB_ERROR (UNSUPPORTED_AUTHENTICATION_METHOD));
 	return;
 }
 
@@ -2467,21 +2501,18 @@ ldap_cancel_op(gpointer key, gpointer value, gpointer data)
 	g_mutex_unlock (bl->priv->ldap_lock);
 }
 
-static GNOME_Evolution_Addressbook_CallStatus
-cancel_operation (EBookBackend *backend, EDataBook *book)
+static void
+cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
 {
 	EBookBackendGAL *bl = E_BOOK_BACKEND_GAL (backend);
 
 	g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
 	g_hash_table_foreach (bl->priv->id_to_op, ldap_cancel_op, bl);
 	g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
-
-	return GNOME_Evolution_Addressbook_Success;
 }
 
 static void
-set_mode (EBookBackend *backend,
-          GNOME_Evolution_Addressbook_BookMode mode)
+set_mode (EBookBackend *backend, EDataBookMode mode)
 {
 	EBookBackendGAL *be = E_BOOK_BACKEND_GAL (backend);
 	EBookBackendGALPrivate *bepriv;
@@ -2494,22 +2525,22 @@ set_mode (EBookBackend *backend,
 	bepriv->mode = mode;
 
 	/* Cancel all running operations */
-	cancel_operation (backend, NULL);
+	cancel_operation (backend, NULL, NULL);
 
 	if (e_book_backend_is_loaded (backend)) {
-		if (mode == GNOME_Evolution_Addressbook_MODE_LOCAL) {
+		if (mode == E_DATA_BOOK_MODE_LOCAL) {
 			e_book_backend_set_is_writable (backend, FALSE);
 			e_book_backend_notify_writable (backend, FALSE);
 			e_book_backend_notify_connection_status (backend, FALSE);
-		} else if (mode == GNOME_Evolution_Addressbook_MODE_REMOTE) {
+		} else if (mode == E_DATA_BOOK_MODE_REMOTE) {
 			e_book_backend_set_is_writable (backend, FALSE);
 			e_book_backend_notify_writable (backend, FALSE);
 			e_book_backend_notify_connection_status (backend, TRUE);
 
 			if (e_book_backend_is_loaded (backend)) {
-				gal_connect (be);
+				gal_connect (be, NULL);
 				e_book_backend_notify_auth_required (backend);
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 				if (bepriv->marked_for_offline && bepriv->file_db) {
 					if (e_book_backend_db_cache_is_populated (be->priv->file_db))
 						update_cache (be);
@@ -2530,7 +2561,7 @@ get_supported_fields (EBookBackend *backend,
 {
 	e_data_book_respond_get_supported_fields (book,
 						  opid,
-						  GNOME_Evolution_Addressbook_Success,
+						  NULL /* Success */,
 						  supported_fields);
 }
 
@@ -2544,7 +2575,7 @@ get_required_fields (EBookBackend *backend,
 	fields = g_list_append (fields, (gchar *) e_contact_field_name (E_CONTACT_FILE_AS));
 	e_data_book_respond_get_required_fields (book,
 						  opid,
-						  GNOME_Evolution_Addressbook_Success,
+						  NULL /* Success */,
 						  fields);
 	g_list_free (fields);
 
@@ -2559,43 +2590,47 @@ get_supported_auth_methods (EBookBackend *backend,
 	d(printf("%s:%s: NONE\n", G_STRLOC, G_STRFUNC));
 	e_data_book_respond_get_supported_auth_methods (book,
 							opid,
-							GNOME_Evolution_Addressbook_Success,
+							NULL /* Success */,
 							NULL);
 }
 
-static GNOME_Evolution_Addressbook_CallStatus
+static void
 load_source (EBookBackend *backend,
 	     ESource      *source,
-	     gboolean      only_if_exists)
+	     gboolean      only_if_exists,
+	     GError      **error)
 {
 	EBookBackendGAL *bl = E_BOOK_BACKEND_GAL (backend);
-	GConfClient *gc = gconf_client_get_default();
 	const gchar *host;
 	gchar **tokens;
 	const gchar *offline;
 	gchar *uri;
 	gchar *book_name = NULL;
+	gint i;
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 	gchar *dirname, *filename;
-	gint i, db_error;
-#if ENABLE_CACHE
+	gint db_error;
 	DB *db;
 	DB_ENV *env;
 #endif
-	g_object_unref (gc);
-	g_return_val_if_fail (bl->priv->connected == FALSE, GNOME_Evolution_Addressbook_OtherError);
+	e_return_data_book_error_if_fail (bl->priv->connected == FALSE, E_DATA_BOOK_STATUS_OTHER_ERROR);
 
 	offline = e_source_get_property (source, "offline_sync");
 	if (offline && g_str_equal (offline, "1"))
 		bl->priv->marked_for_offline = TRUE;
 
-	if (bl->priv->mode ==  GNOME_Evolution_Addressbook_MODE_LOCAL &&
-	    !bl->priv->marked_for_offline)
-		return GNOME_Evolution_Addressbook_OfflineUnavailable;
+	if (bl->priv->mode ==  E_DATA_BOOK_MODE_LOCAL &&
+	    !bl->priv->marked_for_offline) {
+		g_propagate_error (error, EDB_ERROR (OFFLINE_UNAVAILABLE));
+		return;
+	}
 
 	uri = e_source_get_uri (source);
 	host = uri + sizeof ("gal://") - 1;
-	if (strncmp (uri, "gal://", host - uri))
-		return GNOME_Evolution_Addressbook_OtherError;
+	if (strncmp (uri, "gal://", host - uri)) {
+		g_propagate_error (error, EDB_ERROR_EX (OTHER_ERROR, "Not a gal:// URI"));
+		return;
+	}
 
 	bl->priv->gal_uri = g_strdup (uri);
 	tokens = g_strsplit (uri, ";", 2);
@@ -2613,10 +2648,10 @@ load_source (EBookBackend *backend,
 			uri[i] = '_';
 		}
 	}
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 	bl->priv->file_db = NULL;
 #endif
-	if (bl->priv->mode == GNOME_Evolution_Addressbook_MODE_LOCAL && !bl->priv->marked_for_offline) {
+	if (bl->priv->mode == E_DATA_BOOK_MODE_LOCAL && !bl->priv->marked_for_offline) {
 		/* Offline */
 
 		e_book_backend_set_is_loaded (backend, FALSE);
@@ -2627,10 +2662,11 @@ load_source (EBookBackend *backend,
 		g_free (book_name);
 		g_free (uri);
 
-		return GNOME_Evolution_Addressbook_RepositoryOffline;
+		g_propagate_error (error, EDB_ERROR (REPOSITORY_OFFLINE));
+		return;
 	}
 		d(printf("offlin==============\n"));
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 	if (bl->priv->marked_for_offline) {
 		d(printf("offlin==============\n"));
 		bl->priv->summary_file_name = g_build_filename (g_get_home_dir(), ".evolution/cache/addressbook" , uri, book_name, NULL);
@@ -2650,7 +2686,8 @@ load_source (EBookBackend *backend,
 			g_warning ("db recovery failed with %d", db_error);
 			g_free (dirname);
 			g_free (filename);
-			return GNOME_Evolution_Addressbook_OtherError;
+			g_propagate_error (error, EDB_ERROR (OTHER_ERROR));
+			return;
 		}
 
 		g_static_mutex_lock (&global_env_lock);
@@ -2665,7 +2702,8 @@ load_source (EBookBackend *backend,
 				g_static_mutex_unlock (&global_env_lock);
 				g_free (dirname);
 				g_free (filename);
-				return GNOME_Evolution_Addressbook_OtherError;
+				g_propagate_error (error, EDB_ERROR (OTHER_ERROR));
+				return;
 			}
 
 			db_error = (*env->open) (env, NULL, DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_THREAD, 0);
@@ -2675,7 +2713,8 @@ load_source (EBookBackend *backend,
 				g_static_mutex_unlock (&global_env_lock);
 				g_free(dirname);
 				g_free(filename);
-				return GNOME_Evolution_Addressbook_OtherError;
+				g_propagate_error (error, EDB_ERROR (OTHER_ERROR));
+				return;
 			}
 
 			//env->set_errcall (env, file_errcall);
@@ -2690,7 +2729,8 @@ load_source (EBookBackend *backend,
 			g_warning ("db_create failed with %d", db_error);
 			g_free (dirname);
 			g_free (filename);
-			return GNOME_Evolution_Addressbook_OtherError;
+			g_propagate_error (error, EDB_ERROR (OTHER_ERROR));
+			return;
 		}
 
 		db_error = (*db->open) (db, NULL, filename, NULL, DB_HASH, DB_THREAD, 0666);
@@ -2702,7 +2742,8 @@ load_source (EBookBackend *backend,
 				g_warning ("db format upgrade failed with %d", db_error);
 				g_free (filename);
 				g_free (dirname);
-				return GNOME_Evolution_Addressbook_OtherError;
+				g_propagate_error (error, EDB_ERROR (OTHER_ERROR));
+				return;
 			}
 
 			db_error = (*db->open) (db, NULL,filename, NULL, DB_HASH, DB_THREAD, 0666);
@@ -2718,10 +2759,13 @@ load_source (EBookBackend *backend,
 				g_warning ("failed to make directory %s: %s", dirname, strerror (errno));
 				g_free (dirname);
 				g_free (filename);
-				if (errno == EACCES || errno == EPERM)
-					return GNOME_Evolution_Addressbook_PermissionDenied;
-				else
-					return GNOME_Evolution_Addressbook_OtherError;
+				if (errno == EACCES || errno == EPERM) {
+					g_propagate_error (error, EDB_ERROR (PERMISSION_DENIED));
+					return;
+				} else {
+					g_propagate_error (error, EDB_ERROR (OTHER_ERROR));
+					return;
+				}
 			}
 
 			db_error = (*db->open) (db, NULL, filename, NULL, DB_HASH, DB_CREATE | DB_THREAD, 0666);
@@ -2736,7 +2780,8 @@ load_source (EBookBackend *backend,
 
 			g_free (filename);
 			g_free (dirname);
-			return GNOME_Evolution_Addressbook_OtherError;
+			g_propagate_error (error, EDB_ERROR (OTHER_ERROR));
+			return;
 		}
 
 		e_book_backend_db_cache_set_filename (bl->priv->file_db, filename);
@@ -2752,18 +2797,16 @@ load_source (EBookBackend *backend,
 	e_book_backend_set_is_loaded (E_BOOK_BACKEND (backend), TRUE);
 	e_book_backend_notify_writable (backend, FALSE);
 
-	if (bl->priv->mode == GNOME_Evolution_Addressbook_MODE_LOCAL)
+	if (bl->priv->mode == E_DATA_BOOK_MODE_LOCAL)
 		e_book_backend_notify_connection_status (E_BOOK_BACKEND (backend), FALSE);
 	else
 		e_book_backend_notify_connection_status (E_BOOK_BACKEND (backend), TRUE);
-
-	return GNOME_Evolution_Addressbook_Success;
 }
 
 static void
 remove_gal (EBookBackend *backend, EDataBook *book, guint32 opid)
 {
-	e_data_book_respond_remove (book, opid, GNOME_Evolution_Addressbook_PermissionDenied);
+	e_data_book_respond_remove (book, opid, EDB_ERROR (PERMISSION_DENIED));
 }
 
 static gchar *
@@ -2846,7 +2889,7 @@ dispose (GObject *object)
 			g_object_unref (bl->priv->summary);
 			bl->priv->summary = NULL;
 		}
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 		if (bl->priv->file_db)
 			bl->priv->file_db->close (bl->priv->file_db, 0);
 		g_static_mutex_lock (&global_env_lock);
@@ -2928,7 +2971,7 @@ init (EBookBackendGAL *backend)
 	g_static_rec_mutex_init (&priv->op_hash_mutex);
 
 	backend->priv = priv;
-#if ENABLE_CACHE
+#if defined(ENABLE_CACHE) && ENABLE_CACHE
 	priv->last_best_time = 0;
 	priv->cache_time = 0;
 #endif
diff --git a/calendar/e-cal-backend-exchange-calendar.c b/calendar/e-cal-backend-exchange-calendar.c
index 8a84afa..f3d2ae5 100644
--- a/calendar/e-cal-backend-exchange-calendar.c
+++ b/calendar/e-cal-backend-exchange-calendar.c
@@ -57,7 +57,7 @@ static ECalBackendExchange *parent_class = NULL;
 
 #define d(x)
 
-static ECalBackendSyncStatus modify_object_with_href (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, CalObjModType mod, gchar **old_object, gchar **new_object, const gchar *href, const gchar *rid_to_remove);
+static gboolean modify_object_with_href (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, CalObjModType mod, gchar **old_object, gchar **new_object, const gchar *href, const gchar *rid_to_remove, GError **error);
 
 static icalproperty *find_attendee_prop (icalcomponent *ical_comp, const gchar *address);
 static gboolean check_owner_partstatus_for_declined (ECalBackendSync *backend,
@@ -73,14 +73,14 @@ add_timezones_from_comp (ECalBackendExchange *cbex, icalcomponent *icalcomp)
 
 	switch (icalcomponent_isa (icalcomp)) {
 	case ICAL_VTIMEZONE_COMPONENT:
-		e_cal_backend_exchange_add_timezone (cbex, icalcomp);
+		e_cal_backend_exchange_add_timezone (cbex, icalcomp, NULL);
 		break;
 
 	case ICAL_VCALENDAR_COMPONENT:
 		subcomp = icalcomponent_get_first_component (
 			icalcomp, ICAL_VTIMEZONE_COMPONENT);
 		while (subcomp) {
-			e_cal_backend_exchange_add_timezone (cbex, subcomp);
+			e_cal_backend_exchange_add_timezone (cbex, subcomp, NULL);
 			subcomp = icalcomponent_get_next_component (
 				icalcomp, ICAL_VTIMEZONE_COMPONENT);
 		}
@@ -97,7 +97,7 @@ add_vevent (ECalBackendExchange *cbex,
 	    icalcomponent *icalcomp)
 {
 	icalproperty *prop, *transp;
-	ECalBackendSyncStatus status;
+	gboolean res;
 
 	/* We have to do this here, since if we do it inside the loop
 	 * it will mess up the ICAL_X_PROPERTY iterator.
@@ -178,10 +178,10 @@ add_vevent (ECalBackendExchange *cbex,
 
 	e_cal_backend_exchange_cache_lock (cbex);
 	/* Now add to the cache */
-	status = e_cal_backend_exchange_add_object (cbex, href, lastmod, icalcomp);
+	res = e_cal_backend_exchange_add_object (cbex, href, lastmod, icalcomp);
 	e_cal_backend_exchange_cache_unlock (cbex);
 
-	return status;
+	return res;
 }
 
 /* Add the event to the cache, Notify the backend if it is sucessfully added */
@@ -565,28 +565,30 @@ notify_changes (E2kContext *ctx, const gchar *uri,
 
 }
 
-static ECalBackendSyncStatus
+static void
 open_calendar (ECalBackendSync *backend, EDataCal *cal,
 	       gboolean only_if_exists,
-	       const gchar *username, const gchar *password)
+	       const gchar *username, const gchar *password, GError **perror)
 {
-	ECalBackendSyncStatus status;
 	GThread *thread = NULL;
 	GError *error = NULL;
 	ECalBackendExchangeCalendar *cbexc = E_CAL_BACKEND_EXCHANGE_CALENDAR (backend);
 
 	/* Do the generic part */
-	status = E_CAL_BACKEND_SYNC_CLASS (parent_class)->open_sync (
-		backend, cal, only_if_exists, username, password);
-	if (status != GNOME_Evolution_Calendar_Success)
-		return status;
+	E_CAL_BACKEND_SYNC_CLASS (parent_class)->open_sync (
+		backend, cal, only_if_exists, username, password, &error);
+	if (error) {
+		g_propagate_error (perror, error);
+		return;
+	}
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
-		return GNOME_Evolution_Calendar_Success;
+		return; /* Success */
 	}
 
-	if (cbexc->priv->is_loaded)
-		return GNOME_Evolution_Calendar_Success;
+	if (cbexc->priv->is_loaded) {
+		return; /*Success */
+	}
 
 	e_folder_exchange_subscribe (E_CAL_BACKEND_EXCHANGE (backend)->folder,
 			E2K_CONTEXT_OBJECT_CHANGED, 30,
@@ -595,11 +597,9 @@ open_calendar (ECalBackendSync *backend, EDataCal *cal,
 	thread = g_thread_create ((GThreadFunc) get_changed_events, E_CAL_BACKEND_EXCHANGE (backend), FALSE, &error);
 	if (!thread) {
 		g_warning (G_STRLOC ": %s", error->message);
+		g_propagate_error (perror, EDC_ERROR_EX (OtherError, error->message));
 		g_error_free (error);
-
-		return GNOME_Evolution_Calendar_OtherError;
 	}
-	return GNOME_Evolution_Calendar_Success;
 }
 
 struct _cb_data {
@@ -722,9 +722,9 @@ check_owner_partstatus_for_declined (ECalBackendSync *backend,
 	return FALSE;
 }
 
-static ECalBackendSyncStatus
+static void
 create_object (ECalBackendSync *backend, EDataCal *cal,
-	       gchar **calobj, gchar **uid)
+	       gchar **calobj, gchar **uid, GError **error)
 {
 	/* FIXME : Return some value in uid */
 	ECalBackendExchangeCalendar *cbexc;
@@ -755,12 +755,12 @@ create_object (ECalBackendSync *backend, EDataCal *cal,
 	cbexc =	E_CAL_BACKEND_EXCHANGE_CALENDAR (backend);
 	cbex = E_CAL_BACKEND_EXCHANGE (backend);
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), GNOME_Evolution_Calendar_InvalidObject);
-	g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject);
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), InvalidArg);
+	e_return_data_cal_error_if_fail (calobj != NULL, InvalidArg);
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
-		/* FIXME */
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+		return;
 	}
 
 	/* check for permission denied:: priv->writable??
@@ -768,26 +768,30 @@ create_object (ECalBackendSync *backend, EDataCal *cal,
 	 */
 
 	icalcomp = icalparser_parse_string (*calobj);
-	if (!icalcomp)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!icalcomp) {
+		g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return;
+	}
 
 	kind = icalcomponent_isa (icalcomp);
 
 	if (kind != e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
-
 		icalcomponent_free (icalcomp);
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return;
 	}
 
 	temp_comp_uid = icalcomponent_get_uid (icalcomp);
 	if (!temp_comp_uid) {
 		icalcomponent_free (icalcomp);
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return;
 	}
 	#if 0
 	if (lookup_component (E_CAL_BACKEND_EXCHANGE (cbexc), comp_uid))
 	{
 		icalcomponent_free (icalcomp);
+		g_propagate_error (error, EDC_ERROR (OtherError));
 		return;
 	}
 	#endif
@@ -866,7 +870,8 @@ create_object (ECalBackendSync *backend, EDataCal *cal,
 		g_object_unref (comp);
 		icalcomponent_free (cbdata->vcal_comp);
 		g_free (cbdata);
-		return GNOME_Evolution_Calendar_OtherError;
+		g_propagate_error (error, EDC_ERROR_EX (OtherError, "Cannot get comp as string"));
+		return;
 	}
 	real_icalcomp = icalparser_parse_string (*calobj);
 
@@ -939,7 +944,8 @@ create_object (ECalBackendSync *backend, EDataCal *cal,
 		g_object_unref (comp);
 		g_free (location);
 		g_free (lastmod);
-		return GNOME_Evolution_Calendar_OtherError;
+		g_propagate_error (error, EDC_ERROR_HTTP_STATUS (http_status));
+		return;
 	}
 
 	e_cal_backend_exchange_cache_lock (cbex);
@@ -952,8 +958,6 @@ create_object (ECalBackendSync *backend, EDataCal *cal,
 	g_free (lastmod);
 	g_free (location);
 	e2k_properties_free (props);
-
-	return GNOME_Evolution_Calendar_Success;
 }
 
 #define BUSYSTATUS	0x01
@@ -1069,24 +1073,35 @@ update_x_properties (ECalBackendExchange *cbex, ECalComponent *comp)
 	}
 }
 
-static ECalBackendSyncStatus
+static void
 modify_object (ECalBackendSync *backend, EDataCal *cal,
 	       const gchar *calobj, CalObjModType mod,
-	       gchar **old_object, gchar **new_object)
+	       gchar **old_object, gchar **new_object, GError **perror)
 {
-	ECalBackendSyncStatus status;
-
 	d(printf ("ecbexc_modify_object(%p, %p, %d, %s)", backend, cal, mod, *old_object ? *old_object : NULL));
 
-	status = modify_object_with_href (backend, cal, calobj, mod, old_object, new_object, NULL, NULL);
-
-	return status;
+	modify_object_with_href (backend, cal, calobj, mod, old_object, new_object, NULL, NULL, perror);
 }
 
-static ECalBackendSyncStatus
+#define e_return_data_cal_error_and_val_if_fail(expr, _code, _val)		\
+	G_STMT_START {								\
+		if (G_LIKELY(expr)) {						\
+		} else {							\
+			g_log (G_LOG_DOMAIN,					\
+				G_LOG_LEVEL_CRITICAL,				\
+				"file %s: line %d (%s): assertion `%s' failed",	\
+				__FILE__, __LINE__, G_STRFUNC, #expr);		\
+			g_set_error (error, E_DATA_CAL_ERROR, (_code),		\
+				"file %s: line %d (%s): assertion `%s' failed",	\
+				__FILE__, __LINE__, G_STRFUNC, #expr);		\
+			return _val;						\
+		}								\
+	} G_STMT_END
+
+static gboolean
 modify_object_with_href (ECalBackendSync *backend, EDataCal *cal,
 	       const gchar *calobj, CalObjModType mod,
-	       gchar **old_object, gchar **new_object, const gchar *href, const gchar *rid_to_remove)
+	       gchar **old_object, gchar **new_object, const gchar *href, const gchar *rid_to_remove, GError **error)
 {
 	ECalBackendExchangeCalendar *cbexc;
 	ECalBackendExchangeComponent *ecomp;
@@ -1113,32 +1128,34 @@ modify_object_with_href (ECalBackendSync *backend, EDataCal *cal,
 	GList *l = NULL;
 	struct icaltimetype inst_rid;
 	gboolean remove = FALSE;
-	ECalBackendSyncStatus status = GNOME_Evolution_Calendar_Success;
 	GList *to_remove = NULL;
 
 	cbexc =	E_CAL_BACKEND_EXCHANGE_CALENDAR (backend);
 	cbex = E_CAL_BACKEND_EXCHANGE (backend);
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), GNOME_Evolution_Calendar_InvalidObject);
-	g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject);
+	e_return_data_cal_error_and_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), InvalidArg, FALSE);
+	e_return_data_cal_error_and_val_if_fail (calobj != NULL, InvalidArg, FALSE);
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
-                /* FIXME */
-                return GNOME_Evolution_Calendar_InvalidObject;
+                g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+		return FALSE;
         }
 
 	if (rid_to_remove)
 		remove = TRUE;
 
 	icalcomp = icalparser_parse_string (calobj);
-	if (!icalcomp)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!icalcomp) {
+		g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return FALSE;
+	}
 
 	kind = icalcomponent_isa (icalcomp);
 
 	if (kind != e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
 		icalcomponent_free (icalcomp);
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return FALSE;
 	}
 	comp_uid = icalcomponent_get_uid (icalcomp);
 
@@ -1153,7 +1170,8 @@ modify_object_with_href (ECalBackendSync *backend, EDataCal *cal,
 	if (!ecomp) {
 		icalcomponent_free (icalcomp);
 		e_cal_backend_exchange_cache_unlock (cbex);
-		return GNOME_Evolution_Calendar_ObjectNotFound;
+		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+		return FALSE;
 	}
 
 	/* Fetch summary */
@@ -1224,7 +1242,8 @@ modify_object_with_href (ECalBackendSync *backend, EDataCal *cal,
 	if (!updated_icalcomp) {
 		g_object_unref (updated_ecomp);
 		e_cal_backend_exchange_cache_unlock (cbex);
-		return GNOME_Evolution_Calendar_OtherError;
+		g_propagate_error (error, EDC_ERROR_EX (OtherError, "Faild to parse updated ecomp string"));
+		return FALSE;
 	}
 
 	/* Delegated calendar */
@@ -1249,7 +1268,8 @@ modify_object_with_href (ECalBackendSync *backend, EDataCal *cal,
 		g_object_unref (real_ecomp);
 		g_object_unref (updated_ecomp);
 		e_cal_backend_exchange_cache_unlock (cbex);
-		return GNOME_Evolution_Calendar_OtherError;
+		g_propagate_error (error, EDC_ERROR_EX (OtherError, "Failed to set icalcomp to ECalComp"));
+		return FALSE;
 	}
 
 	cbdata = g_new0 (struct _cb_data, 1);
@@ -1341,7 +1361,8 @@ modify_object_with_href (ECalBackendSync *backend, EDataCal *cal,
 		icalcomponent_free (cbdata->vcal_comp);
 		g_free (cbdata);
 		e_cal_backend_exchange_cache_unlock (cbex);
-		return GNOME_Evolution_Calendar_OtherError;
+		g_propagate_error (error, EDC_ERROR_EX (OtherError, "Failed to get real ECalComp as string"));
+		return FALSE;
 	}
 	real_icalcomp = icalparser_parse_string (real_comp_str);
 	g_free (real_comp_str);
@@ -1472,8 +1493,9 @@ modify_object_with_href (ECalBackendSync *backend, EDataCal *cal,
 
 		if (!remove)
 			*new_object = e_cal_component_get_as_string (real_ecomp);
-	} else
-		status = GNOME_Evolution_Calendar_OtherError;
+	} else {
+		g_propagate_error (error, EDC_ERROR_HTTP_STATUS (http_status));
+	}
 
 	g_free (msg);
 	g_object_unref (real_ecomp);
@@ -1486,13 +1508,13 @@ modify_object_with_href (ECalBackendSync *backend, EDataCal *cal,
 	g_free (cbdata);
 	e2k_properties_free (props);
 
-	return status;
+	return !error || !*error;
 }
 
-static ECalBackendSyncStatus
+static void
 remove_object (ECalBackendSync *backend, EDataCal *cal,
 	       const gchar *uid, const gchar *rid, CalObjModType mod,
-	       gchar **old_object, gchar **object)
+	       gchar **old_object, gchar **object, GError **error)
 {
 	ECalBackendExchangeCalendar *cbexc;
 	ECalBackendExchange *cbex;
@@ -1502,7 +1524,6 @@ remove_object (ECalBackendSync *backend, EDataCal *cal,
 	ECalComponent *comp;
 	gchar *calobj, *obj = NULL;
 	struct icaltimetype time_rid;
-	ECalBackendSyncStatus ebs_status;
 
 	/* Will handle only CALOBJ_MOD_THIS and CALOBJ_MOD_ALL for mod.
 	   CALOBJ_MOD_THISANDPRIOR and CALOBJ_MOD_THISANDFUTURE are not
@@ -1511,11 +1532,11 @@ remove_object (ECalBackendSync *backend, EDataCal *cal,
 	cbexc = E_CAL_BACKEND_EXCHANGE_CALENDAR (backend);
 	cbex = E_CAL_BACKEND_EXCHANGE (backend);
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), GNOME_Evolution_Calendar_InvalidObject);
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), InvalidArg);
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
-                /* FIXME */
-                return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+                return;
         }
 
 	e_cal_backend_exchange_cache_lock (cbex);
@@ -1523,7 +1544,8 @@ remove_object (ECalBackendSync *backend, EDataCal *cal,
 
 	if (!ecomp) {
 		e_cal_backend_exchange_cache_unlock (cbex);
-		return GNOME_Evolution_Calendar_ObjectNotFound;
+		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+		return;
 	}
 
 	comp = e_cal_component_new ();
@@ -1536,6 +1558,7 @@ remove_object (ECalBackendSync *backend, EDataCal *cal,
 	/*TODO How handle multiple detached intances with no master object ?*/
 	if (mod == CALOBJ_MOD_THIS && rid && *rid && ecomp->icomp) {
 		gchar *new_object = NULL;
+		gboolean res;
 
 		/*remove a single instance of a recurring event and modify */
 		time_rid = icaltime_from_string (rid);
@@ -1543,11 +1566,11 @@ remove_object (ECalBackendSync *backend, EDataCal *cal,
 		calobj  = (gchar *) icalcomponent_as_ical_string_r (ecomp->icomp);
 
 		e_cal_backend_exchange_cache_unlock (cbex);
-		ebs_status = modify_object_with_href (backend, cal, calobj, mod, &obj, &new_object, NULL, rid);
+		res = modify_object_with_href (backend, cal, calobj, mod, &obj, &new_object, NULL, rid, error);
 		g_object_unref (comp);
 		g_free (calobj);
-		if (ebs_status != GNOME_Evolution_Calendar_Success)
-			goto error;
+		if (!res)
+			return;
 		if (obj) {
 			g_free (*old_object);
 			*old_object = obj;
@@ -1555,7 +1578,7 @@ remove_object (ECalBackendSync *backend, EDataCal *cal,
 
 		g_free (new_object);
 
-		return ebs_status;
+		return;
 	} else
 		e_cal_backend_exchange_cache_unlock (cbex);
 
@@ -1568,19 +1591,18 @@ remove_object (ECalBackendSync *backend, EDataCal *cal,
 		e_cal_backend_exchange_cache_lock (cbex);
 		if (e_cal_backend_exchange_remove_object (E_CAL_BACKEND_EXCHANGE (cbexc), uid)) {
 			e_cal_backend_exchange_cache_unlock (cbex);
-			return GNOME_Evolution_Calendar_Success;
+			return;
 		}
 		e_cal_backend_exchange_cache_unlock (cbex);
 	}
 	*object = NULL;
 
-error:
-	return GNOME_Evolution_Calendar_OtherError;
+	g_propagate_error (error, EDC_ERROR_HTTP_STATUS (status));
 }
 
-static ECalBackendSyncStatus
+static void
 receive_objects (ECalBackendSync *backend, EDataCal *cal,
-		 const gchar *calobj)
+		 const gchar *calobj, GError **error)
 {
 	ECalBackendExchangeCalendar *cbexc;
 	ECalBackendExchange *cbex;
@@ -1590,24 +1612,22 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
 	struct icaltimetype current;
 	icalproperty_method method;
 	icalcomponent *subcomp, *icalcomp;
-	ECalBackendSyncStatus status = GNOME_Evolution_Calendar_Success;
-	GError *error = NULL;
+	GError *err = NULL;
 
 	d(printf ("ecbexc_modify_object(%p, %p, %s)", backend, cal, calobj ? calobj : NULL));
 	cbexc =	E_CAL_BACKEND_EXCHANGE_CALENDAR (backend);
 	cbex =	E_CAL_BACKEND_EXCHANGE (backend);
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), GNOME_Evolution_Calendar_InvalidObject);
-	g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject);
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), InvalidArg);
+	e_return_data_cal_error_if_fail (calobj != NULL, InvalidArg);
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
-                /* FIXME */
-                return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+                return;
         }
 
-	status = e_cal_backend_exchange_extract_components (calobj, &method, &comps);
-	if (status != GNOME_Evolution_Calendar_Success)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!e_cal_backend_exchange_extract_components (calobj, &method, &comps, error))
+		return;
 
 	icalcomp = icalparser_parse_string (calobj);
 
@@ -1617,11 +1637,12 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
 				    comps,
 				    e_cal_backend_exchange_lookup_timezone,
 				    cbex,
-				    &error)) {
-		g_warning ("checking timezones failed: %s", error->message);
+				    &err)) {
+		g_propagate_error (error, EDC_ERROR_EX (InvalidObject, err->message));
+		g_warning ("checking timezones failed: %s", err->message);
 		icalcomponent_free (icalcomp);
-		g_clear_error (&error);
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_clear_error (&err);
+		return;
 	}
 
 	add_timezones_from_comp (E_CAL_BACKEND_EXCHANGE (backend), icalcomp);
@@ -1658,11 +1679,12 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
 				e_cal_backend_exchange_cache_unlock (cbex);
 				if (check_owner_partstatus_for_declined (backend, subcomp)) {
 					ECalComponentId *id = NULL;
-					status = remove_object (backend, cal, uid, NULL,
+					remove_object (backend, cal, uid, NULL,
 								CALOBJ_MOD_ALL, &old_object,
-								NULL);
-					if (status != GNOME_Evolution_Calendar_Success) {
+								NULL, &err);
+					if (err) {
 						g_free (rid);
+						g_propagate_error (error, err);
 						goto error;
 					}
 					id = e_cal_component_get_id (comp);
@@ -1685,12 +1707,9 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
 						mod = CALOBJ_MOD_THIS;
 
 					icalobj = (gchar *) icalcomponent_as_ical_string_r (subcomp);
-					status = modify_object_with_href (backend, cal, icalobj,
+					if (!modify_object_with_href (backend, cal, icalobj,
 									  mod,
-									  &old_object, &new_object, NULL, NULL);
-					d(printf ("Modify this particular instance : %s\n", rid));
-					d(printf ("Modify object : %s\n", icalobj));
-					if (status != GNOME_Evolution_Calendar_Success) {
+									  &old_object, &new_object, NULL, NULL, error)) {
 						g_free (rid);
 						goto error;
 					}
@@ -1718,8 +1737,9 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
 				d(printf ("Create a new object : %s\n", icalobj));
 
 				e_cal_backend_exchange_cache_unlock (cbex);
-				status = create_object (backend, cal, &icalobj, &returned_uid);
-				if (status != GNOME_Evolution_Calendar_Success) {
+				create_object (backend, cal, &icalobj, &returned_uid, &err);
+				if (err) {
+					g_propagate_error (error, err);
 					g_free (rid);
 					goto error;
 				}
@@ -1730,7 +1750,6 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
 				g_free (object);
 			} else {
 				e_cal_backend_exchange_cache_unlock (cbex);
-				status = GNOME_Evolution_Calendar_Success;
 			}
 
 			break;
@@ -1741,14 +1760,16 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
 		case ICAL_METHOD_CANCEL:
 			icalobj = (gchar *) icalcomponent_as_ical_string_r (subcomp);
 			if (rid)
-				status = remove_object (backend, cal, uid, rid, CALOBJ_MOD_THIS, &icalobj, &object);
+				remove_object (backend, cal, uid, rid, CALOBJ_MOD_THIS, &icalobj, &object, &err);
 			else
-				status = remove_object (backend, cal, uid, NULL, CALOBJ_MOD_ALL, &icalobj, &object);
-			if (status == GNOME_Evolution_Calendar_Success) {
+				remove_object (backend, cal, uid, NULL, CALOBJ_MOD_ALL, &icalobj, &object, &err);
+			if (!err) {
 				ECalComponentId *id = e_cal_component_get_id (comp);
 				e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id, icalobj, NULL);
 				e_cal_component_free_id (id);
 
+			} else {
+				g_propagate_error (error, err);
 			}
 			if (object) {
 				g_free (object);
@@ -1757,7 +1778,7 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
 			g_free (icalobj);
 			break;
 		default:
-			status = GNOME_Evolution_Calendar_UnsupportedMethod;
+			g_propagate_error (error, EDC_ERROR (UnsupportedMethod));
 			g_free (rid);
 			goto error;
 		}
@@ -1765,12 +1786,11 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
 		g_free (rid);
 	}
 	g_list_free (comps);
-	return status;
+	return;
 
  error:
 	if (comp)
 		g_object_unref (comp);
-	return status;
 }
 
 typedef enum {
@@ -1796,7 +1816,7 @@ book_resource (ECalBackendExchange *cbex,
 	E2kGlobalCatalogStatus gcstatus;
 	ECalBackendExchangeComponent *ecomp;
 	ECalComponentText old_text, new_text;
-	E2kHTTPStatus status = GNOME_Evolution_Calendar_Success;
+	E2kHTTPStatus status = 0;
 	E2kResult *result;
 	E2kResultIter *iter;
 	ECalComponentDateTime dt;
@@ -1994,27 +2014,31 @@ book_resource (ECalBackendExchange *cbex,
 
 	/* status = e_cal_component_update (comp, method, FALSE  ); */
 	if (ecomp) {
+		gboolean modify_ok = FALSE;
 		/* Use the PUT method to create the meeting item in the resource's calendar. */
-		status = modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, calobj, book_all ? CALOBJ_MOD_ALL : CALOBJ_MOD_THIS, &old_object, &new_object, href, NULL);
-		if (status == GNOME_Evolution_Calendar_Success) {
+		if (modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, calobj, book_all ? CALOBJ_MOD_ALL : CALOBJ_MOD_THIS, &old_object, &new_object, href, NULL, NULL)) {
 			/* Need this to update the participation status of the resource
 			   in the organizer's calendar. */
-			status = modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, calobj, book_all ? CALOBJ_MOD_ALL : CALOBJ_MOD_THIS, &old_object, &new_object, NULL, NULL);
+			modify_ok = modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, calobj, book_all ? CALOBJ_MOD_ALL : CALOBJ_MOD_THIS, &old_object, &new_object, NULL, NULL, NULL);
 		} else {
 			retval = E_CAL_BACKEND_EXCHANGE_BOOKING_ERROR;
 			goto cleanup;
 		}
-		if (status == GNOME_Evolution_Calendar_Success) {
+		if (modify_ok) {
 			e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbex), old_object, calobj);
 			retval = E_CAL_BACKEND_EXCHANGE_BOOKING_OK;
 		}
 		g_free (old_object);
 		g_free (new_object);
 	} else {
-		status = create_object (E_CAL_BACKEND_SYNC (cbex), cal, &calobj, &returned_uid);
-		if (status == GNOME_Evolution_Calendar_Success) {
+		GError *err = NULL;
+
+		create_object (E_CAL_BACKEND_SYNC (cbex), cal, &calobj, &returned_uid, &err);
+		if (!err) {
 			e_cal_backend_notify_object_created (E_CAL_BACKEND (cbex), calobj);
 			retval = E_CAL_BACKEND_EXCHANGE_BOOKING_OK;
+		} else {
+			g_error_free (err);
 		}
 	}
 
@@ -2031,25 +2055,24 @@ book_resource (ECalBackendExchange *cbex,
 	return retval;
 }
 
-static ECalBackendSyncStatus
+static void
 send_objects (ECalBackendSync *backend, EDataCal *cal,
 	      const gchar *calobj,
-	      GList **users, gchar **modified_calobj)
+	      GList **users, gchar **modified_calobj, GError **error)
 {
 	ECalBackendExchange *cbex = (ECalBackendExchange *) backend;
-	ECalBackendSyncStatus retval = GNOME_Evolution_Calendar_Success;
 	ECalBackendExchangeBookingResult result;
 	ECalComponent *comp = NULL;
 	icalcomponent *top_level = NULL, *icalcomp;
 	icalproperty *prop;
 	icalproperty_method method;
-	GError *error = NULL;
+	GError *err = NULL;
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE (cbex),
-				GNOME_Evolution_Calendar_InvalidObject);
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_EXCHANGE (cbex), InvalidArg);
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (cbex))) {
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+		return;
 	}
 
 	*users = NULL;
@@ -2063,10 +2086,10 @@ send_objects (ECalBackendSync *backend, EDataCal *cal,
 				    NULL,
 				    e_cal_backend_exchange_lookup_timezone,
 				    cbex,
-				    &error)) {
-		g_warning ("checking timezones failed: %s", error->message);
-		g_clear_error (&error);
-		retval = FALSE;
+				    &err)) {
+		g_warning ("checking timezones failed: %s", err->message);
+		g_propagate_error (error, EDC_ERROR_EX (OtherError, err->message));
+		g_clear_error (&err);
 		goto cleanup;
 	}
 
@@ -2080,7 +2103,6 @@ send_objects (ECalBackendSync *backend, EDataCal *cal,
 	if (icalcomponent_isa (icalcomp) != ICAL_VEVENT_COMPONENT
 	    || (method != ICAL_METHOD_REQUEST && method != ICAL_METHOD_CANCEL)) {
 		*modified_calobj = g_strdup (calobj);
-		retval = GNOME_Evolution_Calendar_Success;
 		goto cleanup;
 	}
 
@@ -2123,7 +2145,7 @@ send_objects (ECalBackendSync *backend, EDataCal *cal,
 				    _("The resource '%s' is busy during the selected time period."),
 				    attendee + 7);
 #endif
-			retval = GNOME_Evolution_Calendar_ObjectIdAlreadyExists;
+			g_propagate_error (error, EDC_ERROR (ObjectIdAlreadyExists));
 			goto cleanup;
 
 		case E_CAL_BACKEND_EXCHANGE_BOOKING_PERMISSION_DENIED:
@@ -2132,12 +2154,11 @@ send_objects (ECalBackendSync *backend, EDataCal *cal,
 			break;
 		case E_CAL_BACKEND_EXCHANGE_BOOKING_ERROR:
 			/* What should we do here? */
-			retval = GNOME_Evolution_Calendar_PermissionDenied;
+			g_propagate_error (error, EDC_ERROR (PermissionDenied));
 			goto cleanup;
 		}
 	}
 
-	retval = GNOME_Evolution_Calendar_Success;
 	e_cal_component_commit_sequence (comp);
 	*modified_calobj = g_strdup (e_cal_component_get_as_string (comp));
 
@@ -2148,8 +2169,6 @@ send_objects (ECalBackendSync *backend, EDataCal *cal,
 	if (comp) {
 		g_object_unref (comp);
 	}
-
-	return retval;
 }
 
 #define THIRTY_MINUTES (30 * 60)
@@ -2211,29 +2230,26 @@ set_freebusy_info (icalcomponent *vfb, const gchar *data, time_t start)
 	}
 }
 
-static ECalBackendSyncStatus
+static void
 discard_alarm (ECalBackendSync *backend, EDataCal *cal,
-		const gchar *uid, const gchar *auid)
+		const gchar *uid, const gchar *auid, GError **error)
 {
-	ECalBackendSyncStatus result = GNOME_Evolution_Calendar_Success;
 	ECalBackendExchange *cbex = NULL;
 	ECalBackendExchangeComponent *ecbexcomp;
 	ECalComponent *ecomp;
 	gchar *ecomp_str;
 	icalcomponent *icalcomp = NULL;
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (backend),
-					GNOME_Evolution_Calendar_InvalidObject);
-	g_return_val_if_fail (E_IS_DATA_CAL (cal),
-					GNOME_Evolution_Calendar_InvalidObject);
-	g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_OtherError);
-	g_return_val_if_fail (auid != NULL, GNOME_Evolution_Calendar_OtherError);
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (backend), InvalidArg);
+	e_return_data_cal_error_if_fail (E_IS_DATA_CAL (cal), InvalidArg);
+	e_return_data_cal_error_if_fail (uid != NULL, InvalidArg);
+	e_return_data_cal_error_if_fail (auid != NULL, InvalidArg);
 
 	d(printf("ecbe_discard_alarm(%p, %p, uid=%s, auid=%s)\n", backend, cal, uid, auid));
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
-                /* FIXME */
-                return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+                return;
         }
 
 	cbex = E_CAL_BACKEND_EXCHANGE (backend);
@@ -2243,7 +2259,8 @@ discard_alarm (ECalBackendSync *backend, EDataCal *cal,
 
 	if (!ecbexcomp) {
 		e_cal_backend_exchange_cache_unlock (cbex);
-		return GNOME_Evolution_Calendar_ObjectNotFound;
+		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+		return;
 	}
 
 	ecomp = e_cal_component_new ();
@@ -2254,7 +2271,7 @@ discard_alarm (ECalBackendSync *backend, EDataCal *cal,
 		icalcomp = icalparser_parse_string (ecomp_str);
 		if (!e_cal_backend_exchange_modify_object ( cbex,
 					icalcomp, CALOBJ_MOD_ALL, FALSE)) {
-			result = GNOME_Evolution_Calendar_OtherError;
+			g_propagate_error (error, EDC_ERROR (OtherError));
 		}
 		icalcomponent_free (icalcomp);
 		g_free (ecomp_str);
@@ -2262,13 +2279,12 @@ discard_alarm (ECalBackendSync *backend, EDataCal *cal,
 	g_object_unref (ecomp);
 
 	e_cal_backend_exchange_cache_unlock (cbex);
-	return result;
 }
 
-static ECalBackendSyncStatus
+static void
 get_free_busy (ECalBackendSync *backend, EDataCal *cal,
 	       GList *users, time_t start, time_t end,
-	       GList **freebusy)
+	       GList **freebusy, GError **perror)
 {
 	ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
 	gchar *start_str, *end_str;
@@ -2281,8 +2297,8 @@ get_free_busy (ECalBackendSync *backend, EDataCal *cal,
 	xmlDoc *doc;
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
-                /* FIXME */
-                return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
+                return;
         }
 
 	/* The calendar component sets start to "exactly 24 hours
@@ -2311,19 +2327,23 @@ get_free_busy (ECalBackendSync *backend, EDataCal *cal,
 	http_status = e2k_context_get_owa (exchange_account_get_context (cbex->account),
 					   NULL, uri->str, TRUE, &response);
 	g_string_free (uri, TRUE);
-	if (http_status != E2K_HTTP_OK)
-		return GNOME_Evolution_Calendar_OtherError;
+	if (http_status != E2K_HTTP_OK) {
+		g_propagate_error (perror, EDC_ERROR_HTTP_STATUS (http_status));
+		return;
+	}
 
 	/* Parse the XML free/busy response */
 	doc = e2k_parse_xml (response->data, response->length);
 	soup_buffer_free (response);
-	if (!doc)
-		return GNOME_Evolution_Calendar_OtherError;
+	if (!doc) {
+		g_propagate_error (perror, EDC_ERROR_EX (OtherError, "Failed to parse server response"));
+		return;
+	}
 
 	recipients = e2k_xml_find (doc->children, "recipients");
 	if (!recipients) {
 		xmlFreeDoc (doc);
-		return GNOME_Evolution_Calendar_OtherError;
+		g_propagate_error (perror, EDC_ERROR_EX (OtherError, "No 'recipients' in returned XML"));
 	}
 
 	*freebusy = NULL;
@@ -2369,8 +2389,6 @@ get_free_busy (ECalBackendSync *backend, EDataCal *cal,
 		icalcomponent_free (vfb);
 	}
 	xmlFreeDoc (doc);
-
-	return GNOME_Evolution_Calendar_Success;
 }
 
 static void
diff --git a/calendar/e-cal-backend-exchange-tasks.c b/calendar/e-cal-backend-exchange-tasks.c
index 07cad5c..2192edc 100644
--- a/calendar/e-cal-backend-exchange-tasks.c
+++ b/calendar/e-cal-backend-exchange-tasks.c
@@ -646,7 +646,7 @@ get_changed_tasks (ECalBackendExchange *cbex)
 		}
 		e_cal_backend_exchange_cache_unlock (cbex);
 
-		e_cal_backend_exchange_add_timezone (cbex, icalcomp);
+		e_cal_backend_exchange_add_timezone (cbex, icalcomp, NULL);
 
 		itt = icaltime_from_timet (e2k_parse_timestamp (modtime), 0);
 		if (!icaltime_is_null_time (itt)) {
@@ -985,28 +985,29 @@ notify_changes (E2kContext *ctx, const gchar *uri,
 
 }
 
-static ECalBackendSyncStatus
+static void
 open_task (ECalBackendSync *backend, EDataCal *cal,
 	   gboolean only_if_exits,
-	   const gchar *username, const gchar *password)
+	   const gchar *username, const gchar *password, GError **perror)
 {
-	ECalBackendSyncStatus status;
 	GThread *thread = NULL;
 	GError *error = NULL;
 	ECalBackendExchangeTasks *cbext = E_CAL_BACKEND_EXCHANGE_TASKS (backend);
 
-	status = E_CAL_BACKEND_SYNC_CLASS (parent_class)->open_sync (backend,
-				     cal, only_if_exits, username, password);
-	if (status != GNOME_Evolution_Calendar_Success)
-		return status;
+	E_CAL_BACKEND_SYNC_CLASS (parent_class)->open_sync (backend,
+				     cal, only_if_exits, username, password, &error);
+	if (error) {
+		g_propagate_error (perror, error);
+		return;
+	}
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
 		d(printf ("ECBEC : calendar is offline\n"));
-		return GNOME_Evolution_Calendar_Success;
+		return;
 	}
 
 	if (cbext->priv->is_loaded)
-		return GNOME_Evolution_Calendar_Success;
+		return;
 
 	/* Subscribe to the folder to notice changes */
         e_folder_exchange_subscribe (E_CAL_BACKEND_EXCHANGE (backend)->folder,
@@ -1015,13 +1016,9 @@ open_task (ECalBackendSync *backend, EDataCal *cal,
 
 	thread = g_thread_create ((GThreadFunc) get_changed_tasks, E_CAL_BACKEND_EXCHANGE (backend), FALSE, &error);
 	if (!thread) {
-		g_warning (G_STRLOC ": %s", error->message);
+		g_propagate_error (perror, EDC_ERROR_EX (OtherError, error->message));
 		g_error_free (error);
-
-		return GNOME_Evolution_Calendar_OtherError;
 	}
-
-	return GNOME_Evolution_Calendar_Success;
 }
 
 struct _cb_data {
@@ -1030,14 +1027,15 @@ struct _cb_data {
         EDataCal *cal;
 };
 
-static ECalBackendSyncStatus
+static void
 create_task_object (ECalBackendSync *backend, EDataCal *cal,
-		    gchar **calobj, gchar **return_uid)
+		    gchar **calobj, gchar **return_uid, GError **error)
 {
 	ECalBackendExchangeTasks *ecalbextask;
 	ECalBackendExchange *ecalbex;
 	E2kProperties *props;
 	E2kContext *e2kctx;
+	E2kHTTPStatus status;
 	ECalComponent *comp;
 	icalcomponent *icalcomp, *real_icalcomp;
 	icalcomponent_kind kind;
@@ -1050,29 +1048,32 @@ create_task_object (ECalBackendSync *backend, EDataCal *cal,
 	const gchar *summary;
 	gchar * modtime;
 	gchar *location;
-	ECalBackendSyncStatus status;
 	const gchar *temp_comp_uid;
 
 	ecalbextask = E_CAL_BACKEND_EXCHANGE_TASKS (backend);
 	ecalbex = E_CAL_BACKEND_EXCHANGE (backend);
 
-	g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
+	e_return_data_cal_error_if_fail (calobj != NULL, InvalidArg);
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
 		d(printf ("tasks are offline\n"));
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+		return;
 	}
 
 	/* Parse the icalendar text */
 	icalcomp = icalparser_parse_string (*calobj);
-	if (!icalcomp)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!icalcomp) {
+		g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return;
+	}
 
 	/* Check kind with the parent */
 	kind = e_cal_backend_get_kind (E_CAL_BACKEND (ecalbex));
         if (icalcomponent_isa (icalcomp) != kind) {
 		icalcomponent_free (icalcomp);
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return;
         }
 
 	current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
@@ -1094,7 +1095,8 @@ create_task_object (ECalBackendSync *backend, EDataCal *cal,
 	temp_comp_uid = icalcomponent_get_uid (icalcomp);
 	if (!temp_comp_uid) {
 		icalcomponent_free (icalcomp);
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return;
 	}
 
 	e_cal_backend_exchange_cache_lock (ecalbex);
@@ -1103,7 +1105,8 @@ create_task_object (ECalBackendSync *backend, EDataCal *cal,
 					     temp_comp_uid, modtime, NULL, NULL)) {
 		e_cal_backend_exchange_cache_unlock (ecalbex);
 		icalcomponent_free (icalcomp);
-		return GNOME_Evolution_Calendar_ObjectIdAlreadyExists;
+		g_propagate_error (error, EDC_ERROR (ObjectIdAlreadyExists));
+		return;
 	}
 	e_cal_backend_exchange_cache_unlock (ecalbex);
 
@@ -1162,7 +1165,8 @@ create_task_object (ECalBackendSync *backend, EDataCal *cal,
 		g_object_unref (comp);
 		g_free (from_name);
 		g_free (from_addr);
-		return GNOME_Evolution_Calendar_OtherError;
+		g_propagate_error (error, EDC_ERROR_EX (OtherError, "Cannot get ECalComp as string"));
+		return;
 	}
 
 	real_icalcomp = icalparser_parse_string (*calobj);
@@ -1185,17 +1189,19 @@ create_task_object (ECalBackendSync *backend, EDataCal *cal,
 		g_free (modtime);
 	}
 
+	if (!E2K_HTTP_STATUS_IS_SUCCESSFUL (status))
+		g_propagate_error (error, EDC_ERROR_HTTP_STATUS (status));
+
 	*return_uid = g_strdup (temp_comp_uid);
 	icalcomponent_free (real_icalcomp);
 	g_free (from_name);
 	g_free (from_addr);
-	return GNOME_Evolution_Calendar_Success;
 }
 
-static ECalBackendSyncStatus
+static void
 modify_task_object (ECalBackendSync *backend, EDataCal *cal,
 	       const gchar *calobj, CalObjModType mod,
-	       gchar **old_object, gchar **new_object)
+	       gchar **old_object, gchar **new_object, GError **error)
 {
 	ECalBackendExchangeTasks *ecalbextask;
 	ECalBackendExchangeComponent *ecalbexcomp;
@@ -1210,32 +1216,34 @@ modify_task_object (ECalBackendSync *backend, EDataCal *cal,
 	gchar *attach_body_crlf = NULL;
 	gchar *boundary = NULL;
 	struct icaltimetype current;
-	ECalBackendSyncStatus status;
 	E2kContext *e2kctx;
+	E2kHTTPStatus status;
 
 	ecalbextask = E_CAL_BACKEND_EXCHANGE_TASKS (backend);
 	ecalbex = E_CAL_BACKEND_EXCHANGE (backend);
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_TASKS (ecalbextask),
-					GNOME_Evolution_Calendar_NoSuchCal);
-	g_return_val_if_fail (calobj != NULL,
-				GNOME_Evolution_Calendar_ObjectNotFound);
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_EXCHANGE_TASKS (ecalbextask), InvalidArg);
+	e_return_data_cal_error_if_fail (calobj != NULL, InvalidArg);
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
 		d(printf ("tasks are offline\n"));
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+		return;
 	}
 
 	/* Parse the icalendar text */
         icalcomp = icalparser_parse_string ((gchar *) calobj);
-        if (!icalcomp)
-                return GNOME_Evolution_Calendar_InvalidObject;
+        if (!icalcomp) {
+                g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return;
+	}
 
 	/* Check kind with the parent */
         if (icalcomponent_isa (icalcomp) !=
 			e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
                 icalcomponent_free (icalcomp);
-                return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (InvalidObject));
+		return;
         }
 
 	/* Get the uid */
@@ -1249,7 +1257,8 @@ modify_task_object (ECalBackendSync *backend, EDataCal *cal,
 	if (!ecalbexcomp) {
 		icalcomponent_free (icalcomp);
 		e_cal_backend_exchange_cache_unlock (ecalbex);
-		return GNOME_Evolution_Calendar_ObjectNotFound;
+		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+		return;
 	}
 
         cache_comp = e_cal_component_new ();
@@ -1284,8 +1293,10 @@ modify_task_object (ECalBackendSync *backend, EDataCal *cal,
 	comp_str = e_cal_component_get_as_string (new_comp);
 	icalcomp = icalparser_parse_string (comp_str);
 	g_free (comp_str);
-	if (!icalcomp)
-		return GNOME_Evolution_Calendar_OtherError;
+	if (!icalcomp) {
+		g_propagate_error (error, EDC_ERROR_EX (OtherError, "Failed to parse comp_str"));
+		return;
+	}
 	icalcomponent_free (icalcomp);
 
 	get_from (backend, new_comp, &from_name, &from_addr);
@@ -1310,12 +1321,14 @@ modify_task_object (ECalBackendSync *backend, EDataCal *cal,
 		}
 	}
 	icalcomponent_free (icalcomp);
-	return GNOME_Evolution_Calendar_Success;
+
+	if (!E2K_HTTP_STATUS_IS_SUCCESSFUL (status))
+		g_propagate_error (error, EDC_ERROR_HTTP_STATUS (status));
 }
 
-static ECalBackendSyncStatus
+static void
 receive_task_objects (ECalBackendSync *backend, EDataCal *cal,
-                 const gchar *calobj)
+                 const gchar *calobj, GError **error)
 {
 	ECalBackendExchangeTasks *ecalbextask;
 	ECalBackendExchange *cbex;
@@ -1324,24 +1337,22 @@ receive_task_objects (ECalBackendSync *backend, EDataCal *cal,
         struct icaltimetype current;
         icalproperty_method method;
         icalcomponent *subcomp;
-        ECalBackendSyncStatus status = GNOME_Evolution_Calendar_Success;
+	GError *err = NULL;
 
 	ecalbextask = E_CAL_BACKEND_EXCHANGE_TASKS (backend);
 	cbex = E_CAL_BACKEND_EXCHANGE (backend);
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_TASKS (ecalbextask),
-                                        GNOME_Evolution_Calendar_NoSuchCal);
-        g_return_val_if_fail (calobj != NULL,
-                                GNOME_Evolution_Calendar_ObjectNotFound);
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_EXCHANGE_TASKS (ecalbextask), InvalidArg);
+        e_return_data_cal_error_if_fail (calobj != NULL, InvalidArg);
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
 		d(printf ("tasks are offline\n"));
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+		return;
 	}
 
-	status = e_cal_backend_exchange_extract_components (calobj, &method, &comps);
-        if (status != GNOME_Evolution_Calendar_Success)
-                return GNOME_Evolution_Calendar_InvalidObject;
+	if (!e_cal_backend_exchange_extract_components (calobj, &method, &comps, error))
+		return;
 
 	for (l = comps; l; l = l->next) {
                 const gchar *uid;
@@ -1368,10 +1379,11 @@ receive_task_objects (ECalBackendSync *backend, EDataCal *cal,
                         gchar *old_object;
 
 			e_cal_backend_exchange_cache_unlock (cbex);
-                        status = modify_task_object (backend, cal, calobj, CALOBJ_MOD_THIS, &old_object, NULL);
-                        if (status != GNOME_Evolution_Calendar_Success) {
+                        modify_task_object (backend, cal, calobj, CALOBJ_MOD_THIS, &old_object, NULL, &err);
+                        if (err) {
 				g_free (rid);
-                                goto error;
+				g_propagate_error (error, err);
+                                return;
 			}
 
                         e_cal_backend_notify_object_modified (E_CAL_BACKEND (backend), old_object, calobj);
@@ -1381,11 +1393,12 @@ receive_task_objects (ECalBackendSync *backend, EDataCal *cal,
 
 			e_cal_backend_exchange_cache_unlock (cbex);
 			calobj = (gchar *) icalcomponent_as_ical_string_r (subcomp);
-			status = create_task_object (backend, cal, &calobj, &returned_uid);
-                        if (status != GNOME_Evolution_Calendar_Success) {
+			create_task_object (backend, cal, &calobj, &returned_uid, &err);
+                        if (err) {
 				g_free (calobj);
 				g_free (rid);
-                                goto error;
+				g_propagate_error (error, err);
+                                return;
 			}
 
                         e_cal_backend_notify_object_created (E_CAL_BACKEND (backend), calobj);
@@ -1395,27 +1408,25 @@ receive_task_objects (ECalBackendSync *backend, EDataCal *cal,
         }
 
         g_list_free (comps);
-error:
-        return status;
 }
 
-static ECalBackendSyncStatus
+static void
 remove_task_object (ECalBackendSync *backend, EDataCal *cal,
 	       const gchar *uid, const gchar *rid, CalObjModType mod,
-	       gchar **old_object, gchar **object)
+	       gchar **old_object, gchar **object, GError **error)
 {
 	ECalBackendExchange *ecalbex = E_CAL_BACKEND_EXCHANGE (backend);
 	ECalBackendExchangeComponent *ecalbexcomp;
 	ECalComponent *comp;
 	E2kContext *ctx;
-	gint status;
+	E2kHTTPStatus status;
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE (ecalbex),
-					GNOME_Evolution_Calendar_OtherError);
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_EXCHANGE (ecalbex), InvalidArg);
 
 	if (!e_cal_backend_exchange_is_online (E_CAL_BACKEND_EXCHANGE (backend))) {
 		d(printf ("tasks are offline\n"));
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
+		return;
 	}
 
 	e_cal_backend_exchange_cache_lock (ecalbex);
@@ -1423,7 +1434,8 @@ remove_task_object (ECalBackendSync *backend, EDataCal *cal,
 
 	if (!ecalbexcomp || !ecalbexcomp->href) {
 		e_cal_backend_exchange_cache_unlock (ecalbex);
-		return GNOME_Evolution_Calendar_ObjectNotFound;
+		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+		return;
 	}
 
         comp = e_cal_component_new ();
@@ -1438,9 +1450,10 @@ remove_task_object (ECalBackendSync *backend, EDataCal *cal,
 	status = e2k_context_delete (ctx, NULL, ecalbexcomp->href);
 	if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
 		if (e_cal_backend_exchange_remove_object (ecalbex, uid))
-			return GNOME_Evolution_Calendar_Success;
+			return;
 	}
-	return GNOME_Evolution_Calendar_OtherError;
+
+	g_propagate_error (error, EDC_ERROR_HTTP_STATUS (status));
 }
 
 static void
diff --git a/calendar/e-cal-backend-exchange.c b/calendar/e-cal-backend-exchange.c
index 0d217de..304da99 100644
--- a/calendar/e-cal-backend-exchange.c
+++ b/calendar/e-cal-backend-exchange.c
@@ -84,19 +84,18 @@ static GObjectClass *parent_class = NULL;
 static icaltimezone *
 internal_get_timezone (ECalBackend *backend, const gchar *tzid);
 
-static ECalBackendSyncStatus
-is_read_only (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only)
+static void
+is_read_only (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only, GError **perror)
 {
 	ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
 
 	d(printf("ecbe_is_read_only(%p, %p) -> %d\n", backend, cal, cbex->priv->read_only));
 
 	*read_only = cbex->priv->read_only;
-	return GNOME_Evolution_Calendar_Success;
 }
 
-static ECalBackendSyncStatus
-get_cal_address (ECalBackendSync *backend, EDataCal *cal, gchar **address)
+static void
+get_cal_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
 {
 	ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
 	ExchangeHierarchy *hier;
@@ -104,8 +103,6 @@ get_cal_address (ECalBackendSync *backend, EDataCal *cal, gchar **address)
 	hier = e_folder_exchange_get_hierarchy (cbex->folder);
 	d(printf("ecbe_get_cal_address(%p, %p) -> %s\n", backend, cal, hier->owner_email));
 	*address = g_strdup (hier->owner_email);
-
-	return GNOME_Evolution_Calendar_Success;
 }
 
 static void
@@ -120,8 +117,8 @@ get_cal_owner (ECalBackendSync *backend, gchar **name)
 	*name = g_strdup (hier->owner_name);
 }
 
-static ECalBackendSyncStatus
-get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, gchar **address)
+static void
+get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
 {
 	d(printf("ecbe_get_alarm_email_address(%p, %p)\n", backend, cal));
 
@@ -129,24 +126,26 @@ get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, gchar **addres
 	 * This should not have been called.
 	 */
 	*address = NULL;
-	return GNOME_Evolution_Calendar_OtherError;
+
+	g_propagate_error (perror, EDC_ERROR (NotSupported));
 }
 
-static ECalBackendSyncStatus
-get_ldap_attribute (ECalBackendSync *backend, EDataCal *cal, gchar **attribute)
+static void
+get_ldap_attribute (ECalBackendSync *backend, EDataCal *cal, gchar **attribute, GError **perror)
 {
 	d(printf("ecbe_get_ldap_attribute(%p, %p)\n", backend, cal));
 
-	if (!attribute)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!attribute) {
+		g_propagate_error (perror, EDC_ERROR (InvalidObject));
+		return;
+	}
 
 	/* This is just a hack for SunONE */
 	*attribute = NULL;
-	return GNOME_Evolution_Calendar_Success;
 }
 
-static ECalBackendSyncStatus
-get_static_capabilities (ECalBackendSync *backend, EDataCal *cal, gchar **capabilities)
+static void
+get_static_capabilities (ECalBackendSync *backend, EDataCal *cal, gchar **capabilities, GError **perror)
 {
 	d(printf("ecbe_get_static_capabilities(%p, %p)\n", backend, cal));
 
@@ -156,12 +155,10 @@ get_static_capabilities (ECalBackendSync *backend, EDataCal *cal, gchar **capabi
 		CAL_STATIC_CAPABILITY_NO_THISANDFUTURE ","
 		CAL_STATIC_CAPABILITY_NO_THISANDPRIOR ","
 		CAL_STATIC_CAPABILITY_REMOVE_ALARMS);
-
-	return GNOME_Evolution_Calendar_Success;
 }
 
-static ECalBackendSyncStatus
-load_cache (ECalBackendExchange *cbex, E2kUri *e2kuri)
+static gboolean
+load_cache (ECalBackendExchange *cbex, E2kUri *e2kuri, GError **perror)
 {
 	icalcomponent *vcalcomp, *comp, *tmp_comp;
 	struct icaltimetype comp_last_mod, folder_last_mod;
@@ -177,7 +174,8 @@ load_cache (ECalBackendExchange *cbex, E2kUri *e2kuri)
 		e_folder_exchange_get_storage_file (cbex->folder, "cache.ics");
 	if (!cbex->priv->object_cache_file) {
 		printf ("could not load cache for %s\n", uristr);
-		return GNOME_Evolution_Calendar_OfflineUnavailable;
+		g_propagate_error (perror, EDC_ERROR (OfflineUnavailable));
+		return FALSE;
 	}
 
 	/* Fixme : Try avoiding to do this everytime we come here */
@@ -214,15 +212,18 @@ load_cache (ECalBackendExchange *cbex, E2kUri *e2kuri)
        /* Check if the cache file is present. If it is not present the account might
           be newly created one. It will be created while save the cache */
        if (!g_file_test (cbex->priv->object_cache_file, G_FILE_TEST_EXISTS))
-               return GNOME_Evolution_Calendar_Success;
+               return TRUE;
 
 	vcalcomp = e_cal_util_parse_ics_file (cbex->priv->object_cache_file);
-	if (!vcalcomp)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!vcalcomp) {
+		g_propagate_error (perror, EDC_ERROR (InvalidObject));
+		return FALSE;
+	}
 
 	if (icalcomponent_isa (vcalcomp) != ICAL_VCALENDAR_COMPONENT) {
 		icalcomponent_free (vcalcomp);
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (perror, EDC_ERROR (InvalidObject));
+		return FALSE;
 	}
 
 	kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbex));
@@ -249,13 +250,13 @@ load_cache (ECalBackendExchange *cbex, E2kUri *e2kuri)
 	     comp = icalcomponent_get_next_component (vcalcomp, ICAL_VTIMEZONE_COMPONENT)) {
 		tmp_comp = icalcomponent_new_clone (comp);
 		if (tmp_comp) {
-			e_cal_backend_exchange_add_timezone (cbex, tmp_comp);
+			e_cal_backend_exchange_add_timezone (cbex, tmp_comp, perror);
 			icalcomponent_free (tmp_comp);
 		}
 	}
 
 	icalcomponent_free (vcalcomp);
-	return GNOME_Evolution_Calendar_Success;
+	return !perror || !*perror;
 }
 
 static void
@@ -336,9 +337,9 @@ save_cache (ECalBackendExchange *cbex)
 						     cbex);
 }
 
-static ECalBackendSyncStatus
+static void
 open_calendar (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
-	       const gchar *username, const gchar *password)
+	       const gchar *username, const gchar *password, GError **perror)
 {
 	ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
 	const gchar *uristr;
@@ -346,7 +347,7 @@ open_calendar (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
 	ExchangeAccountResult acresult;
 	const gchar *prop = PR_ACCESS;
 	E2kHTTPStatus status;
-	ECalBackendSyncStatus load_status;
+	gboolean load_result;
 	E2kResult *results;
 	E2kUri *euri = NULL;
 	gint nresults = 0;
@@ -370,7 +371,8 @@ open_calendar (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
 
 		if (!display_contents || !g_str_equal (display_contents, "1")) {
 			g_mutex_unlock (cbex->priv->open_lock);
-			return GNOME_Evolution_Calendar_RepositoryOffline;
+			g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
+			return;
 		}
 
 		cbex->account = exchange_share_config_listener_get_account_for_uri (NULL, uristr);
@@ -384,23 +386,23 @@ open_calendar (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
 
 		if (cbex->priv->is_loaded) {
 			g_mutex_unlock (cbex->priv->open_lock);
-			return GNOME_Evolution_Calendar_Success;
+			return;
 		}
 
 		euri = e2k_uri_new (uristr);
-		load_status = load_cache (cbex, euri);
+		load_result = load_cache (cbex, euri, perror);
 		e2k_uri_free (euri);
 
-		if (load_status == GNOME_Evolution_Calendar_Success)
+		if (load_result)
 			cbex->priv->is_loaded = TRUE;
 		g_mutex_unlock (cbex->priv->open_lock);
-		return load_status;
+		return;
 	}
 
 	/* What else to check */
 	if (cbex->priv->is_loaded && cbex->account && exchange_account_get_context (cbex->account)) {
 		g_mutex_unlock (cbex->priv->open_lock);
-		return GNOME_Evolution_Calendar_Success;
+		return;
 	}
 
 	/* Make sure we have an open connection */
@@ -411,7 +413,8 @@ open_calendar (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
 
 	if (!cbex->account) {
 		g_mutex_unlock (cbex->priv->open_lock);
-		return GNOME_Evolution_Calendar_NoSuchCal;
+		g_propagate_error (perror, EDC_ERROR (NoSuchCal));
+		return;
 	}
 
 	exchange_account_set_online (cbex->account);
@@ -419,8 +422,8 @@ open_calendar (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
 	exchange_account_connect (cbex->account, password, &acresult);
 	if (acresult != EXCHANGE_ACCOUNT_CONNECT_SUCCESS) {
 		g_mutex_unlock (cbex->priv->open_lock);
-		e_cal_backend_notify_error (E_CAL_BACKEND (cbex), _("Authentication failed"));
-		return GNOME_Evolution_Calendar_AuthenticationFailed;
+		g_propagate_error (perror, EDC_ERROR (AuthenticationFailed));
+		return;
 	}
 
 	cbex->folder = exchange_account_get_folder (cbex->account, uristr);
@@ -458,7 +461,8 @@ open_calendar (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
 			hier_to_rescan = exchange_account_get_hierarchy_by_type (cbex->account, EXCHANGE_HIERARCHY_PERSONAL);
 			if (!hier_to_rescan) {
 				g_mutex_unlock (cbex->priv->open_lock);
-				return GNOME_Evolution_Calendar_RepositoryOffline;
+				g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
+				return;
 			}
 		}
 
@@ -470,13 +474,12 @@ open_calendar (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
 			g_object_unref (hier_to_rescan->toplevel);
 
 			cbex->folder = exchange_account_get_folder (cbex->account, uristr);
-			if (!cbex->folder)
-				e_cal_backend_notify_error (E_CAL_BACKEND (cbex), _("Could not find the calendar"));
 		}
 
 		if (!cbex->folder) {
 			g_mutex_unlock (cbex->priv->open_lock);
-			return GNOME_Evolution_Calendar_NoSuchCal;
+			g_propagate_error (perror, EDC_ERROR (NoSuchCal));
+			return;
 		}
 	}
 	g_object_ref (cbex->folder);
@@ -502,25 +505,23 @@ open_calendar (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
 		g_mutex_unlock (cbex->priv->open_lock);
 		if (nresults)
 			e2k_results_free (results, nresults);
-		return GNOME_Evolution_Calendar_PermissionDenied;
+		g_propagate_error (perror, EDC_ERROR (PermissionDenied));
+		return;
 	}
 
 	cbex->priv->read_only = ((access & MAPI_ACCESS_CREATE_CONTENTS) == 0);
 
-	load_status = load_cache (cbex, euri);
-
-	if (load_status == GNOME_Evolution_Calendar_Success)
+	if (load_cache (cbex, euri, perror))
 		cbex->priv->is_loaded = TRUE;
 
 	g_mutex_unlock (cbex->priv->open_lock);
 
 	if (nresults)
 		e2k_results_free (results, nresults);
-	return load_status;
 }
 
-static ECalBackendSyncStatus
-remove_calendar (ECalBackendSync *backend, EDataCal *cal)
+static void
+remove_calendar (ECalBackendSync *backend, EDataCal *cal, GError **perror)
 {
 	ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
 	ExchangeAccountFolderResult result;
@@ -531,22 +532,22 @@ remove_calendar (ECalBackendSync *backend, EDataCal *cal)
 	/* If we do not have a folder, then that means there is no corresponding folder on the server,
 	   thus pretend we removed it successfully. It's not there anyway, thus should be fine. */
 	if (!cbex->folder)
-		return GNOME_Evolution_Calendar_Success;
+		return;
 
 	uri = e_folder_exchange_get_internal_uri (cbex->folder);
 	result = exchange_account_remove_folder (cbex->account, uri);
 	if (result == EXCHANGE_ACCOUNT_FOLDER_OK)
-		return GNOME_Evolution_Calendar_Success;
+		/* Success */;
 	else if (result == EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST)
-		return GNOME_Evolution_Calendar_NoSuchCal;
+		g_propagate_error (perror, EDC_ERROR (NoSuchCal));
 	else if (result == EXCHANGE_ACCOUNT_FOLDER_UNSUPPORTED_OPERATION)
-		return GNOME_Evolution_Calendar_PermissionDenied;
+		g_propagate_error (perror, EDC_ERROR (PermissionDenied));
 	else if (result == EXCHANGE_ACCOUNT_FOLDER_OFFLINE)
-		return GNOME_Evolution_Calendar_OfflineUnavailable;
+		g_propagate_error (perror, EDC_ERROR (OfflineUnavailable));
 	else if (result == EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED)
-		return GNOME_Evolution_Calendar_PermissionDenied;
+		g_propagate_error (perror, EDC_ERROR (PermissionDenied));
 	else
-		return GNOME_Evolution_Calendar_OtherError;
+		g_propagate_error (perror, e_data_cal_create_error_fmt (OtherError, "Failed with FolderResult %d", result));
 }
 
 static void
@@ -878,28 +879,28 @@ e_cal_backend_exchange_remove_object (ECalBackendExchange *cbex, const gchar *ui
 	return TRUE;
 }
 
-static ECalBackendSyncStatus
+static void
 discard_alarm (ECalBackendSync *backend, EDataCal *cal,
-	       const gchar *uid, const gchar *auid)
+	       const gchar *uid, const gchar *auid, GError **perror)
 {
 	/* To be called from the Calendar derived class */
-	return GNOME_Evolution_Calendar_OtherError;
+	g_propagate_error (perror, EDC_ERROR (NotSupported));
 }
 
 /*To be overriden by Calendar and Task classes*/
-static ECalBackendSyncStatus
+static void
 create_object (ECalBackendSync *backend, EDataCal *cal,
-	       gchar **calobj, gchar **uid)
+	       gchar **calobj, gchar **uid, GError **perror)
 {
-	return GNOME_Evolution_Calendar_OtherError;
+	g_propagate_error (perror, EDC_ERROR (NotSupported));
 }
 
 /*To be overriden by Calendar and Task classes*/
-static ECalBackendSyncStatus
+static void
 modify_object (ECalBackendSync *backend, EDataCal *cal,
-			const gchar * calobj, CalObjModType mod, gchar **old_object, gchar **new_object)
+			const gchar * calobj, CalObjModType mod, gchar **old_object, gchar **new_object, GError **perror)
 {
-	return GNOME_Evolution_Calendar_OtherError;
+	g_propagate_error (perror, EDC_ERROR (NotSupported));
 }
 
 void
@@ -941,16 +942,16 @@ add_instances_to_vcal (gpointer value, gpointer user_data)
 
 }
 
-static ECalBackendSyncStatus
+static void
 get_object (ECalBackendSync *backend, EDataCal *cal,
-	    const gchar *uid, const gchar *rid, gchar **object)
+	    const gchar *uid, const gchar *rid, gchar **object, GError **error)
 {
 	ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
 	ECalBackendExchangeComponent *ecomp;
 
 	d(printf("ecbe_get_object(%p, %p, uid=%s, rid=%s)\n", backend, cal, uid, rid));
 
-	g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_InvalidObject);
+	e_return_data_cal_error_if_fail (uid != NULL, InvalidArg);
 	/*any other asserts?*/
 
 	*object = NULL;
@@ -959,12 +960,14 @@ get_object (ECalBackendSync *backend, EDataCal *cal,
 	ecomp = g_hash_table_lookup (cbex->priv->objects, uid);
 	if (!ecomp) {
 		g_mutex_unlock (cbex->priv->cache_lock);
-		return GNOME_Evolution_Calendar_ObjectNotFound;
+		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+		return;
 	}
 
 	if (!rid && (!(ecomp->icomp)))	{
 		g_mutex_unlock (cbex->priv->cache_lock);
-		return GNOME_Evolution_Calendar_ObjectNotFound;
+		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+		return;
 	}
 
 	if (rid && *rid) {
@@ -993,7 +996,8 @@ get_object (ECalBackendSync *backend, EDataCal *cal,
 				new_inst = e_cal_util_construct_instance (ecomp->icomp, itt);
 				if (!new_inst) {
 					g_mutex_unlock (cbex->priv->cache_lock);
-					return GNOME_Evolution_Calendar_ObjectNotFound;
+					g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+					return;
 				}
 
 				*object = icalcomponent_as_ical_string_r (new_inst);
@@ -1001,7 +1005,8 @@ get_object (ECalBackendSync *backend, EDataCal *cal,
 			} else {
 				/* Oops. No instance and no master as well !! */
 				g_mutex_unlock (cbex->priv->cache_lock);
-				return GNOME_Evolution_Calendar_ObjectNotFound;
+				g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+				return;
 			} /* Close check for master object */
 		} /* Close check for instance */
 	}/* Close check if rid is being asked */
@@ -1027,24 +1032,23 @@ get_object (ECalBackendSync *backend, EDataCal *cal,
 		}
 	}
 	g_mutex_unlock (cbex->priv->cache_lock);
-
-	return GNOME_Evolution_Calendar_Success;
 }
 
-ECalBackendSyncStatus
+gboolean
 e_cal_backend_exchange_extract_components (const gchar *calobj,
 					   icalproperty_method *method,
-					   GList **comp_list)
+					   GList **comp_list, GError **perror)
 {
 	icalcomponent *icalcomp, *comp = NULL;
 	icalcomponent *subcomp;
 	icalcomponent_kind kind;
 	GList *comps;
-	ECalBackendSyncStatus status = GNOME_Evolution_Calendar_Success;
 
 	icalcomp = icalparser_parse_string (calobj);
-	if (!icalcomp)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!icalcomp) {
+		g_propagate_error (perror, EDC_ERROR (InvalidObject));
+		return FALSE;
+	}
 
 	kind = icalcomponent_isa (icalcomp);
 	if (kind != ICAL_VCALENDAR_COMPONENT) {
@@ -1060,7 +1064,7 @@ e_cal_backend_exchange_extract_components (const gchar *calobj,
 	/*time zone?*/
 	subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
 	while (subcomp) {
-		e_cal_backend_exchange_add_timezone (cbex, icalcomponent_new_clone (subcomp));
+		e_cal_backend_exchange_add_timezone (cbex, icalcomponent_new_clone (subcomp), perror);
 		subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
 	}
 #endif
@@ -1079,8 +1083,8 @@ e_cal_backend_exchange_extract_components (const gchar *calobj,
 				*/
 
 				if (!icalcomponent_get_uid (subcomp)) {
-					status = GNOME_Evolution_Calendar_InvalidObject;
-					goto error;
+					g_propagate_error (perror, EDC_ERROR (InvalidObject));
+					return FALSE;
 				}
 				comps = g_list_prepend (comps, subcomp);
 				break;
@@ -1092,23 +1096,22 @@ e_cal_backend_exchange_extract_components (const gchar *calobj,
 	}
 
 	*comp_list = comps;
-error:
-	return status;
+
+	return TRUE;
 }
 
-static ECalBackendSyncStatus
+static void
 send_objects (ECalBackendSync *backend, EDataCal *cal,
 	      const gchar *calobj,
-	      GList **users, gchar **modified_calobj)
+	      GList **users, gchar **modified_calobj, GError **perror)
 {
 	d(printf("ecbe_send_objects(%p, %p, %s)\n", backend, cal, calobj));
 
-	/* FIXME */
-	return GNOME_Evolution_Calendar_OtherError;
+	g_propagate_error (perror, EDC_ERROR (NotSupported));
 }
 
-static ECalBackendSyncStatus
-get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object)
+static void
+get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object, GError **perror)
 {
 	icalcomponent *comp;
 	gchar *ical_obj;
@@ -1120,8 +1123,6 @@ get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object)
 	*object = ical_obj;
 
 	icalcomponent_free (comp);
-
-	return GNOME_Evolution_Calendar_Success;
 }
 
 typedef struct {
@@ -1190,9 +1191,9 @@ match_object_sexp (gpointer key, gpointer value, gpointer data)
 			match_data);
 }
 
-static ECalBackendSyncStatus
+static void
 get_object_list (ECalBackendSync *backend, EDataCal *cal,
-		 const gchar *sexp, GList **objects)
+		 const gchar *sexp, GList **objects, GError **perror)
 {
 
 	ECalBackendExchange *cbex;
@@ -1212,8 +1213,10 @@ get_object_list (ECalBackendSync *backend, EDataCal *cal,
 		match_data.search_needed = FALSE;
 
 	match_data.obj_sexp = e_cal_backend_sexp_new (sexp);
-	if (!match_data.obj_sexp)
-		return GNOME_Evolution_Calendar_InvalidQuery;
+	if (!match_data.obj_sexp) {
+		g_propagate_error (perror, EDC_ERROR (InvalidQuery));
+		return;
+	}
 
 	g_mutex_lock (priv->cache_lock);
 	g_hash_table_foreach (cbex->priv->objects, (GHFunc) match_object_sexp, &match_data);
@@ -1222,8 +1225,6 @@ get_object_list (ECalBackendSync *backend, EDataCal *cal,
 	*objects = match_data.obj_list;
 
 	g_object_unref (match_data.obj_sexp);
-
-	return GNOME_Evolution_Calendar_Success;
 }
 
 icaltimezone *
@@ -1237,9 +1238,9 @@ e_cal_backend_exchange_get_default_time_zone (ECalBackendSync *backend)
 	return priv->default_timezone;
 }
 
-ECalBackendSyncStatus
+void
 e_cal_backend_exchange_add_timezone (ECalBackendExchange *cbex,
-				     icalcomponent *vtzcomp)
+				     icalcomponent *vtzcomp, GError **perror)
 {
 	icalproperty *prop;
 	icaltimezone *zone;
@@ -1248,57 +1249,63 @@ e_cal_backend_exchange_add_timezone (ECalBackendExchange *cbex,
 	d(printf("ecbe_add_timezone(%p)\n", cbex));
 
 	prop = icalcomponent_get_first_property (vtzcomp, ICAL_TZID_PROPERTY);
-	if (!prop)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!prop) {
+		g_propagate_error (perror, EDC_ERROR (InvalidObject));
+		return;
+	}
 	tzid = icalproperty_get_tzid (prop);
 	d(printf("ecbe_add_timezone: tzid = %s\n", tzid));
-	if (g_hash_table_lookup (cbex->priv->timezones, tzid))
-		return GNOME_Evolution_Calendar_ObjectIdAlreadyExists;
+	if (g_hash_table_lookup (cbex->priv->timezones, tzid)) {
+		g_propagate_error (perror, EDC_ERROR (ObjectIdAlreadyExists));
+		return;
+	}
 
 	zone = icaltimezone_new ();
 	if (!icaltimezone_set_component (zone, icalcomponent_new_clone (vtzcomp))) {
 		icaltimezone_free (zone, TRUE);
-		return GNOME_Evolution_Calendar_InvalidObject;
+		g_propagate_error (perror, EDC_ERROR (InvalidObject));
+		return;
 	}
 
 	g_hash_table_insert (cbex->priv->timezones, g_strdup (tzid), zone);
-	return GNOME_Evolution_Calendar_Success;
 }
 
-static ECalBackendSyncStatus
+static void
 add_timezone (ECalBackendSync *backend, EDataCal *cal,
-	      const gchar *tzobj)
+	      const gchar *tzobj, GError **perror)
 {
 	ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
-	GNOME_Evolution_Calendar_CallStatus status;
 	icalcomponent *vtzcomp;
+	GError *err = NULL;
 
-	if (!tzobj)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!tzobj) {
+		g_propagate_error (perror, EDC_ERROR (InvalidObject));
+		return;
+	}
 
 	vtzcomp = icalcomponent_new_from_string ((gchar *)tzobj);
-	if (!vtzcomp)
-		return GNOME_Evolution_Calendar_InvalidObject;
+	if (!vtzcomp) {
+		g_propagate_error (perror, EDC_ERROR (InvalidObject));
+		return;
+	}
 
-	status = e_cal_backend_exchange_add_timezone (cbex, vtzcomp);
-	switch (status) {
-	case GNOME_Evolution_Calendar_ObjectIdAlreadyExists:
+	e_cal_backend_exchange_add_timezone (cbex, vtzcomp, &err);
+	switch (err ? err->code : Success) {
+	case ObjectIdAlreadyExists:
 		/* fall through */
 
-	case GNOME_Evolution_Calendar_Success:
-		icalcomponent_free (vtzcomp);
-		return GNOME_Evolution_Calendar_Success;
+	case Success:
+		break;
 
 	default:
-		icalcomponent_free (vtzcomp);
-		return status;
+		g_propagate_error (perror, err);
 	}
 	icalcomponent_free (vtzcomp);
 }
 
-static ECalBackendSyncStatus
+static void
 set_default_timezone (ECalBackendSync *backend, EDataCal *cal,
-		      const gchar *tzid)
+		      const gchar *tzid, GError **perror)
 {
 	ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
 
@@ -1310,27 +1317,29 @@ set_default_timezone (ECalBackendSync *backend, EDataCal *cal,
 	*/
 
 	cbex->priv->default_timezone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
-	return GNOME_Evolution_Calendar_Success;
 }
 
 static void
 start_query (ECalBackend *backend, EDataCalView *view)
 {
 	const gchar *sexp = NULL;
-	ECalBackendSyncStatus status = GNOME_Evolution_Calendar_OtherError;
 	GList *m, *objects = NULL;
+	GError *error = NULL;
 
 	d(printf("ecbe_start_query(%p, %p)\n", backend, view));
 
 	sexp = e_data_cal_view_get_text (view);
 	if (!sexp) {
-		e_data_cal_view_notify_done (view, GNOME_Evolution_Calendar_InvalidQuery);
+		error = EDC_ERROR (InvalidQuery);
+		e_data_cal_view_notify_done (view, error);
+		g_error_free (error);
 		return;
 	}
-	status = get_object_list (E_CAL_BACKEND_SYNC (backend), NULL, sexp, &objects);
-	if (status != GNOME_Evolution_Calendar_Success) {
-		 e_data_cal_view_notify_done (view, status);
-		 return;
+	get_object_list (E_CAL_BACKEND_SYNC (backend), NULL, sexp, &objects, &error);
+	if (error) {
+		e_data_cal_view_notify_done (view, error);
+		g_error_free (error);
+		return;
 	}
 
 	if (objects) {
@@ -1341,7 +1350,7 @@ start_query (ECalBackend *backend, EDataCalView *view)
 		g_list_free (objects);
 	}
 
-	e_data_cal_view_notify_done (view, GNOME_Evolution_Calendar_Success);
+	e_data_cal_view_notify_done (view, NULL /* Success */);
 }
 
 gboolean
@@ -1393,7 +1402,7 @@ set_mode (ECalBackend *backend, CalMode mode)
 
 	if (priv->mode == mode) {
 		e_cal_backend_notify_mode (
-			backend, GNOME_Evolution_Calendar_CalListener_MODE_SET,
+			backend, ModeSet,
 			cal_mode_to_corba (mode));
 	}
 
@@ -1405,8 +1414,8 @@ set_mode (ECalBackend *backend, CalMode mode)
 
 	case CAL_MODE_REMOTE:
 			e_cal_backend_notify_mode (backend,
-				GNOME_Evolution_Calendar_CalListener_MODE_SET,
-				GNOME_Evolution_Calendar_MODE_REMOTE);
+				ModeSet,
+				Remote);
 			/* FIXME : Test if available for read already */
 			priv->read_only = FALSE;
 			priv->mode = CAL_MODE_REMOTE;
@@ -1420,27 +1429,26 @@ set_mode (ECalBackend *backend, CalMode mode)
 					priv->mode = CAL_MODE_LOCAL;
 			priv->read_only = TRUE;
 			e_cal_backend_notify_mode (backend,
-				GNOME_Evolution_Calendar_CalListener_MODE_SET,
-				GNOME_Evolution_Calendar_MODE_LOCAL);
+				ModeSet,
+				Local);
 			break;
 
 	default :
 		e_cal_backend_notify_mode (
-			backend, GNOME_Evolution_Calendar_CalListener_MODE_NOT_SUPPORTED,
+			backend, ModeNotSupported,
 			cal_mode_to_corba (mode));
 	}
 	g_mutex_unlock (priv->set_lock);
 }
 
-static ECalBackendSyncStatus
+static void
 get_freebusy (ECalBackendSync *backend, EDataCal *cal,
 	      GList *users, time_t start, time_t end,
-	      GList **freebusy)
+	      GList **freebusy, GError **perror)
 {
 	d(printf("ecbe_get_free_busy(%p, %p)\n", backend, cal));
 
-	/* FIXME */
-	return GNOME_Evolution_Calendar_OtherError;
+	g_propagate_error (perror, EDC_ERROR (NotSupported));
 }
 
 /**
@@ -1479,7 +1487,6 @@ e_cal_backend_exchange_get_from (ECalBackendSync *backend, ECalComponent *comp,
 			gchar **name, gchar **email)
 {
 	ECalComponentOrganizer org;
-	ECalBackendSyncStatus status;
 
 	g_return_if_fail (E_IS_CAL_BACKEND_EXCHANGE (backend));
 
@@ -1489,7 +1496,7 @@ e_cal_backend_exchange_get_from (ECalBackendSync *backend, ECalComponent *comp,
 		*email = g_strdup (org.value);
 	} else {
 		get_cal_owner (backend, name);
-		status = get_cal_address (backend, NULL, email);
+		get_cal_address (backend, NULL, email, NULL);
 	}
 }
 
@@ -2059,10 +2066,10 @@ build_msg ( ECalBackendExchange *cbex, ECalComponent *comp, const gchar *subject
 	return buffer;
 }
 
-static ECalBackendSyncStatus
+static void
 get_changes (ECalBackendSync *backend, EDataCal *cal,
 	     const gchar *change_id,
-	     GList **adds, GList **modifies, GList **deletes)
+	     GList **adds, GList **modifies, GList **deletes, GError **error)
 {
 	ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
 	gchar *path, *filename;
@@ -2072,8 +2079,8 @@ get_changes (ECalBackendSync *backend, EDataCal *cal,
 
 	d(printf("ecbe_get_changes(%p, %p, %s)\n", backend, cal, change_id));
 
-	g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE (cbex), GNOME_Evolution_Calendar_OtherError);
-	g_return_val_if_fail (change_id != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_EXCHANGE (cbex), InvalidArg);
+	e_return_data_cal_error_if_fail (change_id != NULL, ObjectNotFound);
 
 	/* open the changes file */
 	filename = g_strdup_printf ("%s.changes", change_id);
@@ -2103,8 +2110,6 @@ get_changes (ECalBackendSync *backend, EDataCal *cal,
 
 	e_xmlhash_write (ehash);
 	e_xmlhash_destroy (ehash);
-
-	return GNOME_Evolution_Calendar_Success;
 }
 
 static icaltimezone *
diff --git a/calendar/e-cal-backend-exchange.h b/calendar/e-cal-backend-exchange.h
index 970e995..df394c9 100644
--- a/calendar/e-cal-backend-exchange.h
+++ b/calendar/e-cal-backend-exchange.h
@@ -12,6 +12,10 @@
 
 G_BEGIN_DECLS
 
+#define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
+#define EDC_ERROR_EX(_code, _msg) e_data_cal_create_error (_code, _msg)
+#define EDC_ERROR_HTTP_STATUS(_status) e_data_cal_create_error_fmt (OtherError, _("Failed with E2K HTTP status %d"), _status)
+
 #define E_TYPE_CAL_BACKEND_EXCHANGE            (e_cal_backend_exchange_get_type ())
 #define E_CAL_BACKEND_EXCHANGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_BACKEND_EXCHANGE, ECalBackendExchange))
 #define E_CAL_BACKEND_EXCHANGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_BACKEND_EXCHANGE, ECalBackendExchangeClass))
@@ -71,8 +75,9 @@ gboolean  e_cal_backend_exchange_modify_object    (ECalBackendExchange *cbex,
 gboolean  e_cal_backend_exchange_remove_object    (ECalBackendExchange *cbex,
 						   const gchar          *uid);
 
-ECalBackendSyncStatus  e_cal_backend_exchange_add_timezone     (ECalBackendExchange *cbex,
-						   icalcomponent       *vtzcomp);
+void  e_cal_backend_exchange_add_timezone     (ECalBackendExchange *cbex,
+						   icalcomponent       *vtzcomp,
+						   GError **perror);
 
 icaltimezone * e_cal_backend_exchange_get_default_time_zone (ECalBackendSync *backend);
 
@@ -88,9 +93,9 @@ e_cal_backend_exchange_lookup_timezone (const gchar *tzid,
 ECalBackendExchangeComponent * get_exchange_comp (ECalBackendExchange *cbex,
 						  const gchar *uid);
 
-ECalBackendSyncStatus  e_cal_backend_exchange_extract_components (const gchar *calobj,
+gboolean  e_cal_backend_exchange_extract_components (const gchar *calobj,
                                            icalproperty_method *method,
-                                           GList **comp_list);
+                                           GList **comp_list, GError **perror);
 
 /* Utility functions */
 
diff --git a/configure.ac b/configure.ac
index 1d6a966..ce6fcc6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,8 @@ AS_COMPILER_FLAGS(WARNING_FLAGS,
 	-DGDK_DISABLE_DEPRECATED
 	-DGDK_PIXBUF_DISABLE_DEPRECATED
 	-DGTK_DISABLE_DEPRECATED
+	-DE_BOOK_DISABLE_DEPRECATED
+	-DE_CAL_DISABLE_DEPRECATED
 	-DG_DISABLE_SINGLE_INCLUDES
 	-DGTK_DISABLE_SINGLE_INCLUDES
 	-DGSEAL_ENABLE



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