[evolution-data-server] Automatically strip D-Bus info from error messages.



commit 5115e6118bc030d2437d7fa73bb50f1fd31e28d3
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Apr 15 18:54:41 2013 -0400

    Automatically strip D-Bus info from error messages.
    
    I mistakenly assumed code generated by the gdbus-codegen tool would
    automatically strip off the D-Bus error name from error messages, but
    that apparently is not possible according to my discussion with David
    Zeuthen in [1], since it would break g_dbus_error_is_remote_error().
    
    Distinguishing between local and remote errors strikes me as a rarely
    needed corner case, and is certainly not worth the extra step imposed
    on applications when dealing with something as fundamental as GError.
    
    This commit prevents the D-Bus error name from leaking through in any
    Evolution-Data-Server client-facing library functions.
    
    Also rename any stack-allocated GError pointers to 'local_error' to
    help distinguish them from GError "out" parameters which are always
    named 'error'.  This is just to improve variable name consistency.
    
    [1] https://bugzilla.gnome.org/697819

 addressbook/libebook/e-book-client-view.c |  62 ++--
 addressbook/libebook/e-book-client.c      | 317 +++++++++++-------
 calendar/libecal/e-cal-client-view.c      |  41 ++-
 calendar/libecal/e-cal-client.c           | 530 ++++++++++++++++++------------
 libebackend/e-user-prompter.c             |  31 +-
 libedataserver/e-source-registry.c        | 118 ++++---
 libedataserver/e-source.c                 | 163 +++++----
 7 files changed, 751 insertions(+), 511 deletions(-)
---
diff --git a/addressbook/libebook/e-book-client-view.c b/addressbook/libebook/e-book-client-view.c
index e4e0bec..09b61f8 100644
--- a/addressbook/libebook/e-book-client-view.c
+++ b/addressbook/libebook/e-book-client-view.c
@@ -319,22 +319,23 @@ direct_contacts_ready (GObject *source_object,
        NotificationData *data = (NotificationData *) user_data;
        GQueue queue = G_QUEUE_INIT;
        GSList *list = NULL;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        e_book_backend_get_contact_list_finish (
-               E_BOOK_BACKEND (source_object), result, &queue, &error);
+               E_BOOK_BACKEND (source_object),
+               result, &queue, &local_error);
 
        while (!g_queue_is_empty (&queue))
                list = g_slist_prepend (list, g_queue_pop_head (&queue));
 
        list = g_slist_reverse (list);
 
-       if (error != NULL) {
+       if (local_error != NULL) {
                g_warn_if_fail (list == NULL);
                g_warning (
                        "Error fetching contacts directly: %s\n",
-                       error->message);
-               g_error_free (error);
+                       local_error->message);
+               g_error_free (local_error);
 
        } else if (data->signum == OBJECTS_ADDED) {
                /* Takes ownership of the linked list. */
@@ -371,10 +372,10 @@ direct_contacts_fetch (EBookClientView *client_view,
        if (!client_view->priv->complete) {
                GQueue queue = G_QUEUE_INIT;
                GSList *list = NULL;
-               GError *error = NULL;
+               GError *local_error = NULL;
 
                e_book_backend_get_contact_list_sync (
-                       backend, sexp, &queue, NULL, &error);
+                       backend, sexp, &queue, NULL, &local_error);
 
                while (!g_queue_is_empty (&queue)) {
                        list = g_slist_prepend (
@@ -383,12 +384,12 @@ direct_contacts_fetch (EBookClientView *client_view,
 
                list = g_slist_reverse (list);
 
-               if (error != NULL) {
+               if (local_error != NULL) {
                        g_warn_if_fail (list == NULL);
                        g_warning (
                                "Error fetching contacts directly: %s\n",
-                               error->message);
-                       g_error_free (error);
+                               local_error->message);
+                       g_error_free (local_error);
 
                } else if (signum == OBJECTS_ADDED) {
                        /* Takes ownership of the linked list. */
@@ -620,14 +621,15 @@ book_client_view_dispose_cb (GObject *source_object,
                              GAsyncResult *result,
                              gpointer user_data)
 {
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        e_gdbus_book_view_call_dispose_finish (
-               G_DBUS_PROXY (source_object), result, &error);
+               G_DBUS_PROXY (source_object), result, &local_error);
 
-       if (error != NULL) {
-               g_warning ("%s: %s", G_STRFUNC, error->message);
-               g_error_free (error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_warning ("%s: %s", G_STRFUNC, local_error->message);
+               g_error_free (local_error);
        }
 }
 
@@ -1080,7 +1082,6 @@ e_book_client_view_start (EBookClientView *client_view,
                           GError **error)
 {
        EBookClient *client;
-       gboolean success;
        GError *local_error = NULL;
 
        g_return_if_fail (E_IS_BOOK_CLIENT_VIEW (client_view));
@@ -1090,13 +1091,14 @@ e_book_client_view_start (EBookClientView *client_view,
 
        client_view->priv->running = TRUE;
 
-       success = e_gdbus_book_view_call_start_sync (
+       e_gdbus_book_view_call_start_sync (
                client_view->priv->dbus_proxy, NULL, &local_error);
-       if (!success)
-               client_view->priv->running = FALSE;
 
-       e_client_unwrap_dbus_error (
-               E_CLIENT (client), local_error, error);
+       if (local_error != NULL) {
+               client_view->priv->running = FALSE;
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+       }
 
        g_object_unref (client);
 }
@@ -1125,8 +1127,10 @@ e_book_client_view_stop (EBookClientView *client_view,
        e_gdbus_book_view_call_stop_sync (
                client_view->priv->dbus_proxy, NULL, &local_error);
 
-       e_client_unwrap_dbus_error (
-               E_CLIENT (client), local_error, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+       }
 
        g_object_unref (client);
 }
@@ -1157,8 +1161,10 @@ e_book_client_view_set_flags (EBookClientView *client_view,
        e_gdbus_book_view_call_set_flags_sync (
                client_view->priv->dbus_proxy, flags, NULL, &local_error);
 
-       e_client_unwrap_dbus_error (
-               E_CLIENT (client), local_error, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+       }
 
        g_object_unref (client);
 }
@@ -1214,8 +1220,10 @@ e_book_client_view_set_fields_of_interest (EBookClientView *client_view,
                NULL, &local_error);
        g_strfreev (strv);
 
-       e_client_unwrap_dbus_error (
-               E_CLIENT (client), local_error, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+       }
 
        g_object_unref (client);
 }
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index 2c0ef10..39ef4ac 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -773,13 +773,22 @@ book_client_open_sync (EClient *client,
                        GError **error)
 {
        EBookClient *book_client;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
 
        book_client = E_BOOK_CLIENT (client);
 
-       return e_dbus_address_book_call_open_sync (
-               book_client->priv->dbus_proxy, cancellable, error);
+       e_dbus_address_book_call_open_sync (
+               book_client->priv->dbus_proxy, cancellable, &local_error);
+
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 static gboolean
@@ -788,13 +797,22 @@ book_client_refresh_sync (EClient *client,
                           GError **error)
 {
        EBookClient *book_client;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
 
        book_client = E_BOOK_CLIENT (client);
 
-       return e_dbus_address_book_call_refresh_sync (
-               book_client->priv->dbus_proxy, cancellable, error);
+       e_dbus_address_book_call_refresh_sync (
+               book_client->priv->dbus_proxy, cancellable, &local_error);
+
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 static void
@@ -811,7 +829,7 @@ book_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
        const gchar *uid;
        gchar *object_path = NULL;
        gulong handler_id;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        priv = E_BOOK_CLIENT_GET_PRIVATE (source_object);
 
@@ -819,15 +837,17 @@ book_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
        source = e_client_get_source (client);
        uid = e_source_get_uid (source);
 
-       connection = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, &error);
+       connection = g_bus_get_sync (
+               G_BUS_TYPE_SESSION, cancellable, &local_error);
 
        /* Sanity check. */
        g_return_if_fail (
-               ((connection != NULL) && (error == NULL)) ||
-               ((connection == NULL) && (error != NULL)));
+               ((connection != NULL) && (local_error == NULL)) ||
+               ((connection == NULL) && (local_error != NULL)));
 
-       if (error != NULL) {
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
                return;
        }
 
@@ -836,31 +856,33 @@ book_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
                G_DBUS_PROXY_FLAGS_NONE,
                ADDRESS_BOOK_DBUS_SERVICE_NAME,
                "/org/gnome/evolution/dataserver/AddressBookFactory",
-               cancellable, &error);
+               cancellable, &local_error);
 
        /* Sanity check. */
        g_return_if_fail (
-               ((factory_proxy != NULL) && (error == NULL)) ||
-               ((factory_proxy == NULL) && (error != NULL)));
+               ((factory_proxy != NULL) && (local_error == NULL)) ||
+               ((factory_proxy == NULL) && (local_error != NULL)));
 
-       if (error != NULL) {
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
                g_object_unref (connection);
                return;
        }
 
        e_dbus_address_book_factory_call_open_address_book_sync (
-               factory_proxy, uid, &object_path, cancellable, &error);
+               factory_proxy, uid, &object_path, cancellable, &local_error);
 
        g_object_unref (factory_proxy);
 
        /* Sanity check. */
        g_return_if_fail (
-               ((object_path != NULL) && (error == NULL)) ||
-               ((object_path == NULL) && (error != NULL)));
+               ((object_path != NULL) && (local_error == NULL)) ||
+               ((object_path == NULL) && (local_error != NULL)));
 
-       if (error != NULL) {
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
                g_object_unref (connection);
                return;
        }
@@ -869,17 +891,18 @@ book_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
                connection,
                G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
                ADDRESS_BOOK_DBUS_SERVICE_NAME,
-               object_path, cancellable, &error);
+               object_path, cancellable, &local_error);
 
        g_free (object_path);
 
        /* Sanity check. */
        g_return_if_fail (
-               ((priv->dbus_proxy != NULL) && (error == NULL)) ||
-               ((priv->dbus_proxy == NULL) && (error != NULL)));
+               ((priv->dbus_proxy != NULL) && (local_error == NULL)) ||
+               ((priv->dbus_proxy == NULL) && (local_error != NULL)));
 
-       if (error != NULL) {
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
                g_object_unref (connection);
                return;
        }
@@ -1054,7 +1077,7 @@ e_book_client_connect_sync (ESource *source,
                             GError **error)
 {
        EBookClient *client;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_SOURCE (source), NULL);
 
@@ -1062,14 +1085,15 @@ e_book_client_connect_sync (ESource *source,
                E_TYPE_BOOK_CLIENT,
                "source", source, NULL);
 
-       success = g_initable_init (
-               G_INITABLE (client), cancellable, error);
+       g_initable_init (G_INITABLE (client), cancellable, &local_error);
 
-       if (success)
-               success = e_dbus_address_book_call_open_sync (
-                       client->priv->dbus_proxy, cancellable, error);
+       if (local_error == NULL)
+               e_dbus_address_book_call_open_sync (
+                       client->priv->dbus_proxy, cancellable, &local_error);
 
-       if (!success) {
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
                g_prefix_error (
                        error, _("Unable to connect to '%s': "),
                        e_source_get_display_name (source));
@@ -1087,15 +1111,17 @@ book_client_connect_open_cb (GObject *source_object,
                              gpointer user_data)
 {
        GSimpleAsyncResult *simple;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        simple = G_SIMPLE_ASYNC_RESULT (user_data);
 
        e_dbus_address_book_call_open_finish (
-               E_DBUS_ADDRESS_BOOK (source_object), result, &error);
+               E_DBUS_ADDRESS_BOOK (source_object), result, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
+       }
 
        g_simple_async_result_complete (simple);
 
@@ -1111,15 +1137,15 @@ book_client_connect_init_cb (GObject *source_object,
        GSimpleAsyncResult *simple;
        EBookClientPrivate *priv;
        ConnectClosure *closure;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        simple = G_SIMPLE_ASYNC_RESULT (user_data);
 
        g_async_initable_init_finish (
-               G_ASYNC_INITABLE (source_object), result, &error);
+               G_ASYNC_INITABLE (source_object), result, &local_error);
 
-       if (error != NULL) {
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_simple_async_result_take_error (simple, local_error);
                g_simple_async_result_complete (simple);
                goto exit;
        }
@@ -1355,6 +1381,8 @@ e_book_client_connect_direct_sync (ESourceRegistry *registry,
        if (priv->direct_backend != NULL) {
                gboolean success;
 
+               /* Direct backend is not using D-Bus (obviously),
+                * so no need to strip D-Bus info from the error. */
                success = e_book_backend_open_sync (
                        priv->direct_backend, cancellable, error);
 
@@ -1580,7 +1608,7 @@ book_client_add_contact_thread (GSimpleAsyncResult *simple,
                                 GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -1588,10 +1616,10 @@ book_client_add_contact_thread (GSimpleAsyncResult *simple,
                E_BOOK_CLIENT (source_object),
                async_context->contact,
                &async_context->uid,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -1745,7 +1773,7 @@ book_client_add_contacts_thread (GSimpleAsyncResult *simple,
                                  GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -1753,10 +1781,10 @@ book_client_add_contacts_thread (GSimpleAsyncResult *simple,
                E_BOOK_CLIENT (source_object),
                async_context->object_list,
                &async_context->string_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -1888,8 +1916,8 @@ e_book_client_add_contacts_sync (EBookClient *client,
        GSList *link;
        gchar **strv;
        gchar **uids = NULL;
-       gboolean success;
        gint ii = 0;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
        g_return_val_if_fail (contacts != NULL, FALSE);
@@ -1906,20 +1934,23 @@ e_book_client_add_contacts_sync (EBookClient *client,
                g_free (string);
        }
 
-       success = e_dbus_address_book_call_create_contacts_sync (
+       e_dbus_address_book_call_create_contacts_sync (
                client->priv->dbus_proxy,
                (const gchar * const *) strv,
-               &uids, cancellable, error);
+               &uids, cancellable, &local_error);
 
        g_strfreev (strv);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (uids != NULL)) ||
-               (!success && (uids == NULL)), FALSE);
+               ((uids != NULL) && (local_error == NULL)) ||
+               ((uids == NULL) && (local_error != NULL)), FALSE);
 
-       if (!success)
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
                return FALSE;
+       }
 
        /* XXX We should have passed the string array directly
         *     back to the caller instead of building a linked
@@ -1949,17 +1980,17 @@ book_client_modify_contact_thread (GSimpleAsyncResult *simple,
                                    GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_book_client_modify_contact_sync (
                E_BOOK_CLIENT (source_object),
                async_context->contact,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -2073,17 +2104,17 @@ book_client_modify_contacts_thread (GSimpleAsyncResult *simple,
                                     GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_book_client_modify_contacts_sync (
                E_BOOK_CLIENT (source_object),
                async_context->object_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -2184,8 +2215,8 @@ e_book_client_modify_contacts_sync (EBookClient *client,
 {
        GSList *link;
        gchar **strv;
-       gboolean success;
        gint ii = 0;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
        g_return_val_if_fail (contacts != NULL, FALSE);
@@ -2202,14 +2233,20 @@ e_book_client_modify_contacts_sync (EBookClient *client,
                g_free (string);
        }
 
-       success = e_dbus_address_book_call_modify_contacts_sync (
+       e_dbus_address_book_call_modify_contacts_sync (
                client->priv->dbus_proxy,
                (const gchar * const *) strv,
-               cancellable, error);
+               cancellable, &local_error);
 
        g_strfreev (strv);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_book_client_remove_contact() */
@@ -2219,17 +2256,17 @@ book_client_remove_contact_thread (GSimpleAsyncResult *simple,
                                    GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_book_client_remove_contact_sync (
                E_BOOK_CLIENT (source_object),
                async_context->contact,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -2346,17 +2383,17 @@ book_client_remove_contact_by_uid_thread (GSimpleAsyncResult *simple,
                                           GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_book_client_remove_contact_by_uid_sync (
                E_BOOK_CLIENT (source_object),
                async_context->uid,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -2470,17 +2507,17 @@ book_client_remove_contacts_thread (GSimpleAsyncResult *simple,
                                     GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_book_client_remove_contacts_sync (
                E_BOOK_CLIENT (source_object),
                async_context->string_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -2586,8 +2623,8 @@ e_book_client_remove_contacts_sync (EBookClient *client,
                                     GError **error)
 {
        gchar **strv;
-       gboolean success;
        gint ii = 0;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
        g_return_val_if_fail (uids != NULL, FALSE);
@@ -2598,14 +2635,20 @@ e_book_client_remove_contacts_sync (EBookClient *client,
                uids = g_slist_next (uids);
        }
 
-       success = e_dbus_address_book_call_remove_contacts_sync (
+       e_dbus_address_book_call_remove_contacts_sync (
                client->priv->dbus_proxy,
                (const gchar * const *) strv,
-               cancellable, error);
+               cancellable, &local_error);
 
        g_strfreev (strv);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_book_client_get_contact() */
@@ -2615,7 +2658,7 @@ book_client_get_contact_thread (GSimpleAsyncResult *simple,
                                 GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -2623,10 +2666,10 @@ book_client_get_contact_thread (GSimpleAsyncResult *simple,
                E_BOOK_CLIENT (source_object),
                async_context->uid,
                &async_context->contact,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -2743,7 +2786,7 @@ e_book_client_get_contact_sync (EBookClient *client,
 {
        gchar *utf8_uid;
        gchar *vcard = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
@@ -2753,6 +2796,8 @@ e_book_client_get_contact_sync (EBookClient *client,
                EContact *contact;
                gboolean success = FALSE;
 
+               /* Direct backend is not using D-Bus (obviously),
+                * so no need to strip D-Bus info from the error. */
                contact = e_book_backend_get_contact_sync (
                        client->priv->direct_backend,
                        uid, cancellable, error);
@@ -2768,14 +2813,14 @@ e_book_client_get_contact_sync (EBookClient *client,
 
        utf8_uid = e_util_utf8_make_valid (uid);
 
-       success = e_dbus_address_book_call_get_contact_sync (
-               client->priv->dbus_proxy,
-               utf8_uid, &vcard, cancellable, error);
+       e_dbus_address_book_call_get_contact_sync (
+               client->priv->dbus_proxy, utf8_uid,
+               &vcard, cancellable, &local_error);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (vcard != NULL)) ||
-               (!success && (vcard == NULL)), FALSE);
+               ((vcard != NULL) && (local_error == NULL)) ||
+               ((vcard == NULL) && (local_error != NULL)), FALSE);
 
        if (vcard != NULL) {
                *out_contact =
@@ -2785,7 +2830,13 @@ e_book_client_get_contact_sync (EBookClient *client,
 
        g_free (utf8_uid);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_book_client_get_contacts() */
@@ -2795,7 +2846,7 @@ book_client_get_contacts_thread (GSimpleAsyncResult *simple,
                                  GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -2803,10 +2854,10 @@ book_client_get_contacts_thread (GSimpleAsyncResult *simple,
                E_BOOK_CLIENT (source_object),
                async_context->sexp,
                &async_context->object_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -2931,7 +2982,7 @@ e_book_client_get_contacts_sync (EBookClient *client,
 {
        gchar *utf8_sexp;
        gchar **vcards = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
        g_return_val_if_fail (sexp != NULL, FALSE);
@@ -2942,6 +2993,8 @@ e_book_client_get_contacts_sync (EBookClient *client,
                GSList *list = NULL;
                gboolean success;
 
+               /* Direct backend is not using D-Bus (obviously),
+                * so no need to strip D-Bus info from the error. */
                success = e_book_backend_get_contact_list_sync (
                        client->priv->direct_backend,
                        sexp, &queue, cancellable, error);
@@ -2962,16 +3015,16 @@ e_book_client_get_contacts_sync (EBookClient *client,
 
        utf8_sexp = e_util_utf8_make_valid (sexp);
 
-       success = e_dbus_address_book_call_get_contact_list_sync (
-               client->priv->dbus_proxy,
-               utf8_sexp, &vcards, cancellable, error);
+       e_dbus_address_book_call_get_contact_list_sync (
+               client->priv->dbus_proxy, utf8_sexp,
+               &vcards, cancellable, &local_error);
 
        g_free (utf8_sexp);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (vcards != NULL)) ||
-               (!success && (vcards == NULL)), FALSE);
+               ((vcards != NULL) && (local_error == NULL)) ||
+               ((vcards == NULL) && (local_error != NULL)), FALSE);
 
        if (vcards != NULL) {
                EContact *contact;
@@ -2988,7 +3041,13 @@ e_book_client_get_contacts_sync (EBookClient *client,
                g_strfreev (vcards);
        }
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_book_client_get_contacts_uids() */
@@ -2998,7 +3057,7 @@ book_client_get_contacts_uids_thread (GSimpleAsyncResult *simple,
                                       GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -3006,10 +3065,10 @@ book_client_get_contacts_uids_thread (GSimpleAsyncResult *simple,
                E_BOOK_CLIENT (source_object),
                async_context->sexp,
                &async_context->string_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -3134,7 +3193,7 @@ e_book_client_get_contacts_uids_sync (EBookClient *client,
 {
        gchar *utf8_sexp;
        gchar **uids = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
        g_return_val_if_fail (sexp != NULL, FALSE);
@@ -3145,6 +3204,8 @@ e_book_client_get_contacts_uids_sync (EBookClient *client,
                GSList *list = NULL;
                gboolean success;
 
+               /* Direct backend is not using D-Bus (obviously),
+                * so no need to strip D-Bus info from the error. */
                success = e_book_backend_get_contact_list_uids_sync (
                        client->priv->direct_backend,
                        sexp, &queue, cancellable, error);
@@ -3165,16 +3226,16 @@ e_book_client_get_contacts_uids_sync (EBookClient *client,
 
        utf8_sexp = e_util_utf8_make_valid (sexp);
 
-       success = e_dbus_address_book_call_get_contact_list_uids_sync (
-               client->priv->dbus_proxy,
-               utf8_sexp, &uids, cancellable, error);
+       e_dbus_address_book_call_get_contact_list_uids_sync (
+               client->priv->dbus_proxy, utf8_sexp,
+               &uids, cancellable, &local_error);
 
        g_free (utf8_sexp);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (uids != NULL)) ||
-               (!success && (uids == NULL)), FALSE);
+               ((uids != NULL) && (local_error == NULL)) ||
+               ((uids == NULL) && (local_error != NULL)), FALSE);
 
        /* XXX We should have passed the string array directly
         *     back to the caller instead of building a linked
@@ -3194,7 +3255,13 @@ e_book_client_get_contacts_uids_sync (EBookClient *client,
                g_free (uids);
        }
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_book_client_get_view() */
@@ -3207,7 +3274,7 @@ book_client_get_view_in_dbus_thread (GSimpleAsyncResult *simple,
        AsyncContext *async_context;
        gchar *utf8_sexp;
        gchar *object_path = NULL;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -3215,14 +3282,14 @@ book_client_get_view_in_dbus_thread (GSimpleAsyncResult *simple,
 
        e_dbus_address_book_call_get_view_sync (
                client->priv->dbus_proxy, utf8_sexp,
-               &object_path, cancellable, &error);
+               &object_path, cancellable, &local_error);
 
        g_free (utf8_sexp);
 
        /* Sanity check. */
        g_return_if_fail (
-               ((object_path != NULL) && (error == NULL)) ||
-               ((object_path == NULL) && (error != NULL)));
+               ((object_path != NULL) && (local_error == NULL)) ||
+               ((object_path == NULL) && (local_error != NULL)));
 
        if (object_path != NULL) {
                GDBusConnection *connection;
@@ -3233,7 +3300,7 @@ book_client_get_view_in_dbus_thread (GSimpleAsyncResult *simple,
 
                client_view = g_initable_new (
                        E_TYPE_BOOK_CLIENT_VIEW,
-                       cancellable, &error,
+                       cancellable, &local_error,
                        "client", client,
                        "connection", connection,
                        "object-path", object_path,
@@ -3242,16 +3309,18 @@ book_client_get_view_in_dbus_thread (GSimpleAsyncResult *simple,
 
                /* Sanity check. */
                g_return_if_fail (
-                       ((client_view != NULL) && (error == NULL)) ||
-                       ((client_view == NULL) && (error != NULL)));
+                       ((client_view != NULL) && (local_error == NULL)) ||
+                       ((client_view == NULL) && (local_error != NULL)));
 
                async_context->client_view = client_view;
 
                g_free (object_path);
        }
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
+       }
 }
 
 /**
diff --git a/calendar/libecal/e-cal-client-view.c b/calendar/libecal/e-cal-client-view.c
index 0d07517..20f3603 100644
--- a/calendar/libecal/e-cal-client-view.c
+++ b/calendar/libecal/e-cal-client-view.c
@@ -464,14 +464,15 @@ cal_client_view_dispose_cb (GObject *source_object,
                             GAsyncResult *result,
                             gpointer user_data)
 {
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        e_gdbus_cal_view_call_dispose_finish (
-               G_DBUS_PROXY (source_object), result, &error);
+               G_DBUS_PROXY (source_object), result, &local_error);
 
-       if (error != NULL) {
-               g_warning ("%s: %s", G_STRFUNC, error->message);
-               g_error_free (error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_warning ("%s: %s", G_STRFUNC, local_error->message);
+               g_error_free (local_error);
        }
 }
 
@@ -916,7 +917,6 @@ e_cal_client_view_start (ECalClientView *client_view,
                          GError **error)
 {
        ECalClient *client;
-       gboolean success;
        GError *local_error = NULL;
 
        g_return_if_fail (E_IS_CAL_CLIENT_VIEW (client_view));
@@ -926,13 +926,14 @@ e_cal_client_view_start (ECalClientView *client_view,
 
        client_view->priv->running = TRUE;
 
-       success = e_gdbus_cal_view_call_start_sync (
+       e_gdbus_cal_view_call_start_sync (
                client_view->priv->dbus_proxy, NULL, &local_error);
-       if (!success)
-               client_view->priv->running = FALSE;
 
-       e_client_unwrap_dbus_error (
-               E_CLIENT (client), local_error, error);
+       if (local_error != NULL) {
+               client_view->priv->running = FALSE;
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+       }
 
        g_object_unref (client);
 }
@@ -963,8 +964,10 @@ e_cal_client_view_stop (ECalClientView *client_view,
        e_gdbus_cal_view_call_stop_sync (
                client_view->priv->dbus_proxy, NULL, &local_error);
 
-       e_client_unwrap_dbus_error (
-               E_CLIENT (client), local_error, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+       }
 
        g_object_unref (client);
 }
@@ -1009,8 +1012,10 @@ e_cal_client_view_set_fields_of_interest (ECalClientView *client_view,
                NULL, &local_error);
        g_strfreev (strv);
 
-       e_client_unwrap_dbus_error (
-               E_CLIENT (client), local_error, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+       }
 
        g_object_unref (client);
 }
@@ -1040,8 +1045,10 @@ e_cal_client_view_set_flags (ECalClientView *client_view,
        e_gdbus_cal_view_call_set_flags_sync (
                client_view->priv->dbus_proxy, flags, NULL, &local_error);
 
-       e_client_unwrap_dbus_error (
-               E_CLIENT (client), local_error, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+       }
 
        g_object_unref (client);
 }
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index 00ef1b2..2ee4a1f 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -953,13 +953,22 @@ cal_client_open_sync (EClient *client,
                       GError **error)
 {
        ECalClient *cal_client;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
 
        cal_client = E_CAL_CLIENT (client);
 
-       return e_dbus_calendar_call_open_sync (
-               cal_client->priv->dbus_proxy, cancellable, error);
+       e_dbus_calendar_call_open_sync (
+               cal_client->priv->dbus_proxy, cancellable, &local_error);
+
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 static gboolean
@@ -968,13 +977,22 @@ cal_client_refresh_sync (EClient *client,
                          GError **error)
 {
        ECalClient *cal_client;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
 
        cal_client = E_CAL_CLIENT (client);
 
-       return e_dbus_calendar_call_refresh_sync (
-               cal_client->priv->dbus_proxy, cancellable, error);
+       e_dbus_calendar_call_refresh_sync (
+               cal_client->priv->dbus_proxy, cancellable, &local_error);
+
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 static void
@@ -991,7 +1009,7 @@ cal_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
        const gchar *uid;
        gchar *object_path = NULL;
        gulong handler_id;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        priv = E_CAL_CLIENT_GET_PRIVATE (source_object);
 
@@ -999,15 +1017,17 @@ cal_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
        source = e_client_get_source (client);
        uid = e_source_get_uid (source);
 
-       connection = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, &error);
+       connection = g_bus_get_sync (
+               G_BUS_TYPE_SESSION, cancellable, &local_error);
 
        /* Sanity check. */
        g_return_if_fail (
-               ((connection != NULL) && (error == NULL)) ||
-               ((connection == NULL) && (error != NULL)));
+               ((connection != NULL) && (local_error == NULL)) ||
+               ((connection == NULL) && (local_error != NULL)));
 
-       if (error != NULL) {
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
                return;
        }
 
@@ -1016,15 +1036,16 @@ cal_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
                G_DBUS_PROXY_FLAGS_NONE,
                CALENDAR_DBUS_SERVICE_NAME,
                "/org/gnome/evolution/dataserver/CalendarFactory",
-               cancellable, &error);
+               cancellable, &local_error);
 
        /* Sanity check. */
        g_return_if_fail (
-               ((factory_proxy != NULL) && (error == NULL)) ||
-               ((factory_proxy == NULL) && (error != NULL)));
+               ((factory_proxy != NULL) && (local_error == NULL)) ||
+               ((factory_proxy == NULL) && (local_error != NULL)));
 
-       if (error != NULL) {
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
                g_object_unref (connection);
                return;
        }
@@ -1033,17 +1054,17 @@ cal_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
                case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
                        e_dbus_calendar_factory_call_open_calendar_sync (
                                factory_proxy, uid, &object_path,
-                               cancellable, &error);
+                               cancellable, &local_error);
                        break;
                case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
                        e_dbus_calendar_factory_call_open_task_list_sync (
                                factory_proxy, uid, &object_path,
-                               cancellable, &error);
+                               cancellable, &local_error);
                        break;
                case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
                        e_dbus_calendar_factory_call_open_memo_list_sync (
                                factory_proxy, uid, &object_path,
-                               cancellable, &error);
+                               cancellable, &local_error);
                        break;
                default:
                        g_return_if_reached ();
@@ -1053,11 +1074,12 @@ cal_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
 
        /* Sanity check. */
        g_return_if_fail (
-               ((object_path != NULL) && (error == NULL)) ||
-               ((object_path == NULL) && (error != NULL)));
+               ((object_path != NULL) && (local_error == NULL)) ||
+               ((object_path == NULL) && (local_error != NULL)));
 
        if (object_path == NULL) {
-               g_simple_async_result_take_error (simple, error);
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
                g_object_unref (connection);
                return;
        }
@@ -1066,17 +1088,18 @@ cal_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
                connection,
                G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
                CALENDAR_DBUS_SERVICE_NAME,
-               object_path, cancellable, &error);
+               object_path, cancellable, &local_error);
 
        g_free (object_path);
 
        /* Sanity check. */
        g_return_if_fail (
-               ((priv->dbus_proxy != NULL) && (error == NULL)) ||
-               ((priv->dbus_proxy == NULL) && (error != NULL)));
+               ((priv->dbus_proxy != NULL) && (local_error == NULL)) ||
+               ((priv->dbus_proxy == NULL) && (local_error != NULL)));
 
-       if (error != NULL) {
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
                g_object_unref (connection);
                return;
        }
@@ -1468,7 +1491,7 @@ e_cal_client_connect_sync (ESource *source,
                            GError **error)
 {
        ECalClient *client;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_SOURCE (source), NULL);
        g_return_val_if_fail (
@@ -1481,14 +1504,15 @@ e_cal_client_connect_sync (ESource *source,
                "source", source,
                "source-type", source_type, NULL);
 
-       success = g_initable_init (
-               G_INITABLE (client), cancellable, error);
+       g_initable_init (G_INITABLE (client), cancellable, &local_error);
 
-       if (success)
-               success = e_dbus_calendar_call_open_sync (
-                       client->priv->dbus_proxy, cancellable, error);
+       if (local_error == NULL)
+               e_dbus_calendar_call_open_sync (
+                       client->priv->dbus_proxy, cancellable, &local_error);
 
-       if (!success) {
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
                g_prefix_error (
                        error,_("Unable to connect to '%s': "),
                        e_source_get_display_name (source));
@@ -1506,15 +1530,17 @@ cal_client_connect_open_cb (GObject *source_object,
                             gpointer user_data)
 {
        GSimpleAsyncResult *simple;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        simple = G_SIMPLE_ASYNC_RESULT (user_data);
 
        e_dbus_calendar_call_open_finish (
-               E_DBUS_CALENDAR (source_object), result, &error);
+               E_DBUS_CALENDAR (source_object), result, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
+       }
 
        g_simple_async_result_complete (simple);
 
@@ -1530,15 +1556,15 @@ cal_client_connect_init_cb (GObject *source_object,
        GSimpleAsyncResult *simple;
        ECalClientPrivate *priv;
        ConnectClosure *closure;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        simple = G_SIMPLE_ASYNC_RESULT (user_data);
 
        g_async_initable_init_finish (
-               G_ASYNC_INITABLE (source_object), result, &error);
+               G_ASYNC_INITABLE (source_object), result, &local_error);
 
-       if (error != NULL) {
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_simple_async_result_take_error (simple, local_error);
                g_simple_async_result_complete (simple);
                goto exit;
        }
@@ -1993,17 +2019,18 @@ e_cal_client_resolve_tzid_cb (const gchar *tzid,
 {
        ECalClient *client = data;
        icaltimezone *zone = NULL;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
 
-       e_cal_client_get_timezone_sync (client, tzid, &zone, NULL, &error);
+       e_cal_client_get_timezone_sync (
+               client, tzid, &zone, NULL, &local_error);
 
-       if (error != NULL) {
+       if (local_error != NULL) {
                g_debug (
                        "%s: Failed to find '%s' timezone: %s",
-                       G_STRFUNC, tzid, error->message);
-               g_error_free (error);
+                       G_STRFUNC, tzid, local_error->message);
+               g_error_free (local_error);
        }
 
        return zone;
@@ -2427,16 +2454,16 @@ get_objects_sync (ECalClient *client,
 
        /* Generate objects */
        if (uid && *uid) {
-               GError *error = NULL;
+               GError *local_error = NULL;
 
                e_cal_client_get_objects_for_uid_sync (
-                       client, uid, &objects, NULL, &error);
+                       client, uid, &objects, NULL, &local_error);
 
-               if (error != NULL) {
+               if (local_error != NULL) {
                        g_warning (
                                "Failed to get recurrence objects "
-                               "for uid: %s\n", error->message);
-                       g_clear_error (&error);
+                               "for uid: %s\n", local_error->message);
+                       g_error_free (local_error);
                        return NULL;
                }
        } else {
@@ -2513,7 +2540,7 @@ got_objects_for_uid_cb (GObject *source_object,
 {
        struct get_objects_async_data *goad = user_data;
        GSList *objects = NULL;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        g_return_if_fail (source_object != NULL);
        g_return_if_fail (result != NULL);
@@ -2521,17 +2548,17 @@ got_objects_for_uid_cb (GObject *source_object,
        g_return_if_fail (goad->client == E_CAL_CLIENT (source_object));
 
        e_cal_client_get_objects_for_uid_finish (
-               goad->client, result, &objects, &error);
+               goad->client, result, &objects, &local_error);
 
-       if (error != NULL) {
-               if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
-                   g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+       if (local_error != NULL) {
+               if (g_error_matches (local_error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
+                   g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
                        free_get_objects_async_data (goad);
-                       g_clear_error (&error);
+                       g_error_free (local_error);
                        return;
                }
 
-               g_clear_error (&error);
+               g_clear_error (&local_error);
                objects = NULL;
        }
 
@@ -2548,7 +2575,7 @@ got_object_list_as_comps_cb (GObject *source_object,
 {
        struct get_objects_async_data *goad = user_data;
        GSList *objects = NULL;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        g_return_if_fail (source_object != NULL);
        g_return_if_fail (result != NULL);
@@ -2556,17 +2583,17 @@ got_object_list_as_comps_cb (GObject *source_object,
        g_return_if_fail (goad->client == E_CAL_CLIENT (source_object));
 
        e_cal_client_get_object_list_as_comps_finish (
-               goad->client, result, &objects, &error);
+               goad->client, result, &objects, &local_error);
 
-       if (error != NULL) {
-               if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
-                   g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+       if (local_error != NULL) {
+               if (g_error_matches (local_error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
+                   g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
                        free_get_objects_async_data (goad);
-                       g_clear_error (&error);
+                       g_error_free (local_error);
                        return;
                }
 
-               g_clear_error (&error);
+               g_clear_error (&local_error);
                objects = NULL;
        }
 
@@ -3170,17 +3197,17 @@ cal_client_get_default_object_thread (GSimpleAsyncResult *simple,
                                       GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_cal_client_get_default_object_sync (
                E_CAL_CLIENT (source_object),
                &async_context->out_comp,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -3334,7 +3361,7 @@ cal_client_get_object_thread (GSimpleAsyncResult *simple,
                               GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -3343,10 +3370,10 @@ cal_client_get_object_thread (GSimpleAsyncResult *simple,
                async_context->uid,
                async_context->rid,
                &async_context->out_comp,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -3488,7 +3515,7 @@ e_cal_client_get_object_sync (ECalClient *client,
        gchar *utf8_uid;
        gchar *utf8_rid;
        gchar *string = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
@@ -3500,20 +3527,23 @@ e_cal_client_get_object_sync (ECalClient *client,
        utf8_uid = e_util_utf8_make_valid (uid);
        utf8_rid = e_util_utf8_make_valid (rid);
 
-       success = e_dbus_calendar_call_get_object_sync (
+       e_dbus_calendar_call_get_object_sync (
                client->priv->dbus_proxy, utf8_uid, utf8_rid,
-               &string, cancellable, error);
+               &string, cancellable, &local_error);
 
        g_free (utf8_uid);
        g_free (utf8_rid);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (string != NULL)) ||
-               (!success && (string == NULL)), FALSE);
+               ((string != NULL) && (local_error == NULL)) ||
+               ((string == NULL) && (local_error != NULL)), FALSE);
 
-       if (!success)
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
                return FALSE;
+       }
 
        icalcomp = icalparser_parse_string (string);
 
@@ -3589,7 +3619,7 @@ cal_client_get_objects_for_uid_thread (GSimpleAsyncResult *simple,
                                        GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -3597,10 +3627,10 @@ cal_client_get_objects_for_uid_thread (GSimpleAsyncResult *simple,
                E_CAL_CLIENT (source_object),
                async_context->uid,
                &async_context->object_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -3727,7 +3757,7 @@ e_cal_client_get_objects_for_uid_sync (ECalClient *client,
        icalcomponent_kind kind;
        gchar *utf8_uid;
        gchar *string = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
@@ -3735,19 +3765,22 @@ e_cal_client_get_objects_for_uid_sync (ECalClient *client,
 
        utf8_uid = e_util_utf8_make_valid (uid);
 
-       success = e_dbus_calendar_call_get_object_sync (
+       e_dbus_calendar_call_get_object_sync (
                client->priv->dbus_proxy, utf8_uid, "",
-               &string, cancellable, error);
+               &string, cancellable, &local_error);
 
        g_free (utf8_uid);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (string != NULL)) ||
-               (!success && (string == NULL)), FALSE);
+               ((string != NULL) && (local_error == NULL)) ||
+               ((string == NULL) && (local_error != NULL)), FALSE);
 
-       if (!success)
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
                return FALSE;
+       }
 
        icalcomp = icalparser_parse_string (string);
 
@@ -3820,7 +3853,7 @@ cal_client_get_object_list_thread (GSimpleAsyncResult *simple,
                                    GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -3828,10 +3861,10 @@ cal_client_get_object_list_thread (GSimpleAsyncResult *simple,
                E_CAL_CLIENT (source_object),
                async_context->sexp,
                &async_context->comp_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -3953,8 +3986,8 @@ e_cal_client_get_object_list_sync (ECalClient *client,
        GSList *tmp = NULL;
        gchar *utf8_sexp;
        gchar **strv = NULL;
-       gboolean success;
        gint ii;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (sexp != NULL, FALSE);
@@ -3962,19 +3995,22 @@ e_cal_client_get_object_list_sync (ECalClient *client,
 
        utf8_sexp = e_util_utf8_make_valid (sexp);
 
-       success = e_dbus_calendar_call_get_object_list_sync (
+       e_dbus_calendar_call_get_object_list_sync (
                client->priv->dbus_proxy, utf8_sexp,
-               &strv, cancellable, error);
+               &strv, cancellable, &local_error);
 
        g_free (utf8_sexp);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (strv != NULL)) ||
-               (!success && (strv == NULL)), FALSE);
+               ((strv != NULL) && (local_error == NULL)) ||
+               ((strv == NULL) && (local_error != NULL)), FALSE);
 
-       if (!success)
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
                return FALSE;
+       }
 
        for (ii = 0; strv[ii] != NULL; ii++) {
                icalcomponent *icalcomp;
@@ -3998,7 +4034,7 @@ cal_client_get_object_list_as_comps_thread (GSimpleAsyncResult *simple,
                                             GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -4006,10 +4042,10 @@ cal_client_get_object_list_as_comps_thread (GSimpleAsyncResult *simple,
                E_CAL_CLIENT (source_object),
                async_context->sexp,
                &async_context->object_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -4182,7 +4218,7 @@ cal_client_get_free_busy_thread (GSimpleAsyncResult *simple,
                                  GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -4191,10 +4227,10 @@ cal_client_get_free_busy_thread (GSimpleAsyncResult *simple,
                async_context->start,
                async_context->end,
                async_context->string_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -4309,8 +4345,8 @@ e_cal_client_get_free_busy_sync (ECalClient *client,
                                  GError **error)
 {
        gchar **strv;
-       gboolean success;
        gint ii = 0;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (start > 0, FALSE);
@@ -4322,15 +4358,21 @@ e_cal_client_get_free_busy_sync (ECalClient *client,
                users = g_slist_next (users);
        }
 
-       success = e_dbus_calendar_call_get_free_busy_sync (
+       e_dbus_calendar_call_get_free_busy_sync (
                client->priv->dbus_proxy,
                (gint64) start, (gint64) end,
                (const gchar * const *) strv,
-               cancellable, error);
+               cancellable, &local_error);
 
        g_strfreev (strv);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_cal_client_create_object() */
@@ -4340,7 +4382,7 @@ cal_client_create_object_thread (GSimpleAsyncResult *simple,
                                  GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -4348,10 +4390,10 @@ cal_client_create_object_thread (GSimpleAsyncResult *simple,
                E_CAL_CLIENT (source_object),
                async_context->in_comp,
                &async_context->uid,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -4502,7 +4544,7 @@ cal_client_create_objects_thread (GSimpleAsyncResult *simple,
                                   GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -4510,10 +4552,10 @@ cal_client_create_objects_thread (GSimpleAsyncResult *simple,
                E_CAL_CLIENT (source_object),
                async_context->comp_list,
                &async_context->string_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -4638,8 +4680,8 @@ e_cal_client_create_objects_sync (ECalClient *client,
 {
        gchar **strv;
        gchar **uids = NULL;
-       gboolean success;
        gint ii = 0;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (icalcomps != NULL, FALSE);
@@ -4656,17 +4698,17 @@ e_cal_client_create_objects_sync (ECalClient *client,
                icalcomps = g_slist_next (icalcomps);
        }
 
-       success = e_dbus_calendar_call_create_objects_sync (
+       e_dbus_calendar_call_create_objects_sync (
                client->priv->dbus_proxy,
                (const gchar * const *) strv,
-               &uids, cancellable, error);
+               &uids, cancellable, &local_error);
 
        g_strfreev (strv);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (uids != NULL)) ||
-               (!success && (uids == NULL)), FALSE);
+               ((uids != NULL) && (local_error == NULL)) ||
+               ((uids == NULL) && (local_error != NULL)), FALSE);
 
        if (uids != NULL) {
                GSList *tmp = NULL;
@@ -4682,7 +4724,13 @@ e_cal_client_create_objects_sync (ECalClient *client,
 
        g_strfreev (uids);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_cal_client_modify_object() */
@@ -4692,7 +4740,7 @@ cal_client_modify_object_thread (GSimpleAsyncResult *simple,
                                  GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -4700,10 +4748,10 @@ cal_client_modify_object_thread (GSimpleAsyncResult *simple,
                E_CAL_CLIENT (source_object),
                async_context->in_comp,
                async_context->mod,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -4835,7 +4883,7 @@ cal_client_modify_objects_thread (GSimpleAsyncResult *simple,
                                   GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -4843,10 +4891,10 @@ cal_client_modify_objects_thread (GSimpleAsyncResult *simple,
                E_CAL_CLIENT (source_object),
                async_context->comp_list,
                async_context->mod,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -4966,9 +5014,9 @@ e_cal_client_modify_objects_sync (ECalClient *client,
        GFlagsClass *flags_class;
        GFlagsValue *flags_value;
        GString *flags;
-       gboolean success;
        gchar **strv;
        gint ii = 0;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (comps != NULL, FALSE);
@@ -4995,17 +5043,23 @@ e_cal_client_modify_objects_sync (ECalClient *client,
                comps = g_slist_next (comps);
        }
 
-       success = e_dbus_calendar_call_modify_objects_sync (
+       e_dbus_calendar_call_modify_objects_sync (
                client->priv->dbus_proxy,
                (const gchar * const *) strv,
-               flags->str, cancellable, error);
+               flags->str, cancellable, &local_error);
 
        g_strfreev (strv);
 
        g_type_class_unref (flags_class);
        g_string_free (flags, TRUE);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_cal_client_remove_object() */
@@ -5015,7 +5069,7 @@ cal_client_remove_object_thread (GSimpleAsyncResult *simple,
                                  GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -5024,10 +5078,10 @@ cal_client_remove_object_thread (GSimpleAsyncResult *simple,
                async_context->uid,
                async_context->rid,
                async_context->mod,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -5162,7 +5216,7 @@ cal_client_remove_objects_thread (GSimpleAsyncResult *simple,
                                   GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -5170,10 +5224,10 @@ cal_client_remove_objects_thread (GSimpleAsyncResult *simple,
                E_CAL_CLIENT (source_object),
                async_context->string_list,
                async_context->mod,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -5291,7 +5345,7 @@ e_cal_client_remove_objects_sync (ECalClient *client,
        GFlagsValue *flags_value;
        GString *flags;
        guint n_valid_uids = 0;
-       gboolean success = TRUE;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (ids != NULL, FALSE);
@@ -5322,13 +5376,12 @@ e_cal_client_remove_objects_sync (ECalClient *client,
                 * backward-compatibility, even though INVALID_ARG might
                 * be more appropriate. */
                if (*id->uid == '\0') {
-                       g_set_error_literal (
-                               error, E_CAL_CLIENT_ERROR,
+                       local_error = g_error_new_literal (
+                               E_CAL_CLIENT_ERROR,
                                E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND,
                                e_cal_client_error_to_string (
                                E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND));
                        n_valid_uids = 0;
-                       success = FALSE;
                        break;
                }
 
@@ -5347,10 +5400,10 @@ e_cal_client_remove_objects_sync (ECalClient *client,
        }
 
        if (n_valid_uids > 0) {
-               success = e_dbus_calendar_call_remove_objects_sync (
+               e_dbus_calendar_call_remove_objects_sync (
                        client->priv->dbus_proxy,
                        g_variant_builder_end (&builder),
-                       flags->str, cancellable, error);
+                       flags->str, cancellable, &local_error);
        } else {
                g_variant_builder_clear (&builder);
        }
@@ -5358,7 +5411,13 @@ e_cal_client_remove_objects_sync (ECalClient *client,
        g_type_class_unref (flags_class);
        g_string_free (flags, TRUE);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_cal_client_receive_objects() */
@@ -5368,17 +5427,17 @@ cal_client_receive_objects_thread (GSimpleAsyncResult *simple,
                                    GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_cal_client_receive_objects_sync (
                E_CAL_CLIENT (source_object),
                async_context->in_comp,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -5483,21 +5542,27 @@ e_cal_client_receive_objects_sync (ECalClient *client,
 {
        gchar *ical_string;
        gchar *utf8_ical_string;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
 
        ical_string = icalcomponent_as_ical_string_r (icalcomp);
        utf8_ical_string = e_util_utf8_make_valid (ical_string);
 
-       success = e_dbus_calendar_call_receive_objects_sync (
-               client->priv->dbus_proxy,
-               utf8_ical_string, cancellable, error);
+       e_dbus_calendar_call_receive_objects_sync (
+               client->priv->dbus_proxy, utf8_ical_string,
+               cancellable, &local_error);
 
        g_free (utf8_ical_string);
        g_free (ical_string);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_cal_client_send_objects() */
@@ -5507,7 +5572,7 @@ cal_client_send_objects_thread (GSimpleAsyncResult *simple,
                                 GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -5516,10 +5581,10 @@ cal_client_send_objects_thread (GSimpleAsyncResult *simple,
                async_context->in_comp,
                &async_context->string_list,
                &async_context->out_comp,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -5657,7 +5722,7 @@ e_cal_client_send_objects_sync (ECalClient *client,
        gchar *utf8_ical_string;
        gchar **users = NULL;
        gchar *out_ical_string = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (icalcomp != NULL, FALSE);
@@ -5667,20 +5732,22 @@ e_cal_client_send_objects_sync (ECalClient *client,
        ical_string = icalcomponent_as_ical_string_r (icalcomp);
        utf8_ical_string = e_util_utf8_make_valid (ical_string);
 
-       success = e_dbus_calendar_call_send_objects_sync (
-               client->priv->dbus_proxy, utf8_ical_string,
-               &users, &out_ical_string, cancellable, error);
+       e_dbus_calendar_call_send_objects_sync (
+               client->priv->dbus_proxy, utf8_ical_string, &users,
+               &out_ical_string, cancellable, &local_error);
 
        g_free (utf8_ical_string);
        g_free (ical_string);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (out_ical_string != NULL)) ||
-               (!success && (out_ical_string == NULL)), FALSE);
+               ((out_ical_string != NULL) && (local_error == NULL)) ||
+               ((out_ical_string == NULL) && (local_error != NULL)), FALSE);
 
-       if (!success) {
+       if (local_error != NULL) {
                g_warn_if_fail (users == NULL);
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
                return FALSE;
        }
 
@@ -5724,7 +5791,7 @@ cal_client_get_attachment_uris_thread (GSimpleAsyncResult *simple,
                                        GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -5733,10 +5800,10 @@ cal_client_get_attachment_uris_thread (GSimpleAsyncResult *simple,
                async_context->uid,
                async_context->rid,
                &async_context->string_list,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -5861,7 +5928,7 @@ e_cal_client_get_attachment_uris_sync (ECalClient *client,
        gchar *utf8_uid;
        gchar *utf8_rid;
        gchar **uris = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
@@ -5873,17 +5940,17 @@ e_cal_client_get_attachment_uris_sync (ECalClient *client,
        utf8_uid = e_util_utf8_make_valid (uid);
        utf8_rid = e_util_utf8_make_valid (rid);
 
-       success = e_dbus_calendar_call_get_attachment_uris_sync (
-               client->priv->dbus_proxy, utf8_uid,
-               utf8_rid, &uris, cancellable, error);
+       e_dbus_calendar_call_get_attachment_uris_sync (
+               client->priv->dbus_proxy, utf8_uid, utf8_rid,
+               &uris, cancellable, &local_error);
 
        g_free (utf8_uid);
        g_free (utf8_rid);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (uris != NULL)) ||
-               (!success && (uris == NULL)), FALSE);
+               ((uris != NULL) && (local_error == NULL)) ||
+               ((uris == NULL) && (local_error != NULL)), FALSE);
 
        if (uris != NULL) {
                GSList *tmp = NULL;
@@ -5897,7 +5964,13 @@ e_cal_client_get_attachment_uris_sync (ECalClient *client,
                *out_attachment_uris = g_slist_reverse (tmp);
        }
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_cal_client_discard_alarm() */
@@ -5907,7 +5980,7 @@ cal_client_discard_alarm_thread (GSimpleAsyncResult *simple,
                                  GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -5916,10 +5989,10 @@ cal_client_discard_alarm_thread (GSimpleAsyncResult *simple,
                async_context->uid,
                async_context->rid,
                async_context->auid,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -6032,7 +6105,7 @@ e_cal_client_discard_alarm_sync (ECalClient *client,
        gchar *utf8_uid;
        gchar *utf8_rid;
        gchar *utf8_auid;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
@@ -6045,15 +6118,22 @@ e_cal_client_discard_alarm_sync (ECalClient *client,
        utf8_rid = e_util_utf8_make_valid (rid);
        utf8_auid = e_util_utf8_make_valid (auid);
 
-       success = e_dbus_calendar_call_discard_alarm_sync (
-               client->priv->dbus_proxy, utf8_uid,
-               utf8_rid, utf8_auid, cancellable, error);
+       e_dbus_calendar_call_discard_alarm_sync (
+               client->priv->dbus_proxy,
+               utf8_uid, utf8_rid, utf8_auid,
+               cancellable, &local_error);
 
        g_free (utf8_uid);
        g_free (utf8_rid);
        g_free (utf8_auid);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for e_cal_client_get_view() */
@@ -6066,7 +6146,7 @@ cal_client_get_view_in_dbus_thread (GSimpleAsyncResult *simple,
        AsyncContext *async_context;
        gchar *utf8_sexp;
        gchar *object_path = NULL;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -6074,14 +6154,14 @@ cal_client_get_view_in_dbus_thread (GSimpleAsyncResult *simple,
 
        e_dbus_calendar_call_get_view_sync (
                client->priv->dbus_proxy, utf8_sexp,
-               &object_path, cancellable, &error);
+               &object_path, cancellable, &local_error);
 
        g_free (utf8_sexp);
 
        /* Sanity check. */
        g_return_if_fail (
-               ((object_path != NULL) && (error == NULL)) ||
-               ((object_path == NULL) && (error != NULL)));
+               ((object_path != NULL) && (local_error == NULL)) ||
+               ((object_path == NULL) && (local_error != NULL)));
 
        if (object_path != NULL) {
                GDBusConnection *connection;
@@ -6092,7 +6172,7 @@ cal_client_get_view_in_dbus_thread (GSimpleAsyncResult *simple,
 
                client_view = g_initable_new (
                        E_TYPE_CAL_CLIENT_VIEW,
-                       cancellable, &error,
+                       cancellable, &local_error,
                        "client", client,
                        "connection", connection,
                        "object-path", object_path,
@@ -6100,16 +6180,18 @@ cal_client_get_view_in_dbus_thread (GSimpleAsyncResult *simple,
 
                /* Sanity check. */
                g_return_if_fail (
-                       ((client_view != NULL) && (error == NULL)) ||
-                       ((client_view == NULL) && (error != NULL)));
+                       ((client_view != NULL) && (local_error == NULL)) ||
+                       ((client_view == NULL) && (local_error != NULL)));
 
                async_context->client_view = client_view;
 
                g_free (object_path);
        }
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_simple_async_result_take_error (simple, local_error);
+       }
 }
 
 /**
@@ -6255,7 +6337,7 @@ cal_client_get_timezone_thread (GSimpleAsyncResult *simple,
                                 GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -6263,10 +6345,10 @@ cal_client_get_timezone_thread (GSimpleAsyncResult *simple,
                E_CAL_CLIENT (source_object),
                async_context->tzid,
                &async_context->zone,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -6386,7 +6468,7 @@ e_cal_client_get_timezone_sync (ECalClient *client,
        icaltimezone *zone;
        gchar *utf8_tzid;
        gchar *string = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (tzid != NULL, FALSE);
@@ -6401,19 +6483,22 @@ e_cal_client_get_timezone_sync (ECalClient *client,
 
        utf8_tzid = e_util_utf8_make_valid (tzid);
 
-       success = e_dbus_calendar_call_get_timezone_sync (
+       e_dbus_calendar_call_get_timezone_sync (
                client->priv->dbus_proxy, utf8_tzid,
-               &string, cancellable, error);
+               &string, cancellable, &local_error);
 
        g_free (utf8_tzid);
 
        /* Sanity check. */
        g_return_val_if_fail (
-               (success && (string != NULL)) ||
-               (!success && (string == NULL)), FALSE);
+               ((string != NULL) && (local_error == NULL)) ||
+               ((string == NULL) && (local_error != NULL)), FALSE);
 
-       if (!success)
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
                return FALSE;
+       }
 
        icalcomp = icalparser_parse_string (string);
 
@@ -6460,17 +6545,17 @@ cal_client_add_timezone_thread (GSimpleAsyncResult *simple,
                                 GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_cal_client_add_timezone_sync (
                E_CAL_CLIENT (source_object),
                async_context->zone,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -6581,7 +6666,7 @@ e_cal_client_add_timezone_sync (ECalClient *client,
        icalcomponent *icalcomp;
        gchar *zone_str;
        gchar *utf8_zone_str;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
        g_return_val_if_fail (zone != NULL, FALSE);
@@ -6600,12 +6685,19 @@ e_cal_client_add_timezone_sync (ECalClient *client,
        zone_str = icalcomponent_as_ical_string_r (icalcomp);
        utf8_zone_str = e_util_utf8_make_valid (zone_str);
 
-       success = e_dbus_calendar_call_add_timezone_sync (
-               client->priv->dbus_proxy, utf8_zone_str, cancellable, error);
+       e_dbus_calendar_call_add_timezone_sync (
+               client->priv->dbus_proxy, utf8_zone_str,
+               cancellable, &local_error);
 
        g_free (zone_str);
        g_free (utf8_zone_str);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
diff --git a/libebackend/e-user-prompter.c b/libebackend/e-user-prompter.c
index 127b9fd..59fe0cb 100644
--- a/libebackend/e-user-prompter.c
+++ b/libebackend/e-user-prompter.c
@@ -143,7 +143,7 @@ user_prompter_prompt_invoke (EDBusUserPrompter *dbus_prompter,
 {
        GPtrArray *captions;
        GList *list, *link;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (dbus_prompter != NULL, FALSE);
        g_return_val_if_fail (async_data != NULL, FALSE);
@@ -161,7 +161,7 @@ user_prompter_prompt_invoke (EDBusUserPrompter *dbus_prompter,
        /* NULL-terminated array */
        g_ptr_array_add (captions, NULL);
 
-       success = e_dbus_user_prompter_call_prompt_sync (
+       e_dbus_user_prompter_call_prompt_sync (
                dbus_prompter,
                async_data->type ? async_data->type : "",
                async_data->title ? async_data->title : "",
@@ -170,12 +170,17 @@ user_prompter_prompt_invoke (EDBusUserPrompter *dbus_prompter,
                async_data->use_markup,
                (const gchar *const *) captions->pdata,
                &async_data->prompt_id,
-               cancellable,
-               error);
+               cancellable, &local_error);
 
        g_ptr_array_free (captions, TRUE);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 static void
@@ -201,24 +206,30 @@ user_prompter_extension_prompt_invoke (EDBusUserPrompter *dbus_prompter,
                                        GCancellable *cancellable,
                                        GError **error)
 {
-       gboolean success;
        gchar **params;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (dbus_prompter != NULL, FALSE);
        g_return_val_if_fail (async_data != NULL, FALSE);
 
        params = e_named_parameters_to_strv (async_data->in_parameters);
-       success = e_dbus_user_prompter_call_extension_prompt_sync (
+
+       e_dbus_user_prompter_call_extension_prompt_sync (
                dbus_prompter,
                async_data->dialog_name,
                (const gchar *const *) params,
                &async_data->prompt_id,
-               cancellable,
-               error);
+               cancellable, &local_error);
 
        g_strfreev (params);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 static void
diff --git a/libedataserver/e-source-registry.c b/libedataserver/e-source-registry.c
index 6c4f2fd..5ad52cb 100644
--- a/libedataserver/e-source-registry.c
+++ b/libedataserver/e-source-registry.c
@@ -125,7 +125,6 @@ struct _AuthContext {
        ESourceAuthenticationResult auth_result;
        GcrSecretExchange *secret_exchange;
        gboolean authenticating;
-       gboolean success;
        GError **error;
 };
 
@@ -564,24 +563,24 @@ source_registry_new_source (ESourceRegistry *registry,
        GMainContext *main_context;
        ESource *source;
        const gchar *object_path;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        /* We don't want the ESource emitting "changed" signals from
         * the manager thread, so we pass it the same main context the
         * registry uses for scheduling signal emissions. */
        main_context = registry->priv->main_context;
-       source = e_source_new (dbus_object, main_context, &error);
+       source = e_source_new (dbus_object, main_context, &local_error);
        object_path = g_dbus_object_get_object_path (dbus_object);
 
        /* The likelihood of an error here is slim, so it's
         * sufficient to just print a warning if one occurs. */
-       if (error != NULL) {
+       if (local_error != NULL) {
                g_warn_if_fail (source == NULL);
                g_critical (
                        "ESourceRegistry: Failed to create a "
                        "data source object for path '%s': %s",
-                       object_path, error->message);
-               g_error_free (error);
+                       object_path, local_error->message);
+               g_error_free (local_error);
                return NULL;
        }
 
@@ -1048,6 +1047,7 @@ source_registry_initable_init (GInitable *initable,
 {
        ESourceRegistry *registry;
        ThreadClosure *closure;
+       GError *local_error = NULL;
 
        registry = E_SOURCE_REGISTRY (initable);
 
@@ -1082,6 +1082,7 @@ source_registry_initable_init (GInitable *initable,
 
        /* Check for error in the manager thread. */
        if (closure->error != NULL) {
+               g_dbus_error_strip_remote_error (closure->error);
                g_propagate_error (error, closure->error);
                closure->error = NULL;
                return FALSE;
@@ -1115,10 +1116,13 @@ source_registry_initable_init (GInitable *initable,
                        G_DBUS_PROXY_FLAGS_NONE,
                        SOURCES_DBUS_SERVICE_NAME,
                        DBUS_OBJECT_PATH,
-                       cancellable, error);
+                       cancellable, &local_error);
 
-       if (registry->priv->dbus_source_manager == NULL)
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
                return FALSE;
+       }
 
        /* Allow authentication prompts for all exported data sources
         * when a new EDBusSourceManagerProxy is created.  The thought
@@ -1459,7 +1463,7 @@ source_registry_authenticate_thread (GSimpleAsyncResult *simple,
                                      GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -1467,10 +1471,10 @@ source_registry_authenticate_thread (GSimpleAsyncResult *simple,
                E_SOURCE_REGISTRY (object),
                async_context->source,
                async_context->auth,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /* Helper for e_source_registry_authenticate_sync() */
@@ -1507,7 +1511,6 @@ source_registry_authenticate_respond_cb (AuthContext *auth_context)
                        auth_context->dbus_auth,
                        NULL, &non_fatal_error);
                g_main_loop_quit (auth_context->main_loop);
-               auth_context->success = FALSE;
 
        /* If an error occurred while attempting to authenticate,
         * tell the server to cancel the authentication session. */
@@ -1517,7 +1520,6 @@ source_registry_authenticate_respond_cb (AuthContext *auth_context)
                        auth_context->cancellable,
                        &non_fatal_error);
                g_main_loop_quit (auth_context->main_loop);
-               auth_context->success = FALSE;
 
        /* If the password was accepted, let the server know so it
         * can close any authentication dialogs and save the user
@@ -1528,7 +1530,6 @@ source_registry_authenticate_respond_cb (AuthContext *auth_context)
                        auth_context->cancellable,
                        &non_fatal_error);
                g_main_loop_quit (auth_context->main_loop);
-               auth_context->success = TRUE;
 
        /* If the password was rejected, let the server know so it can
         * indicate failure and request a different password, and then
@@ -1543,6 +1544,7 @@ source_registry_authenticate_respond_cb (AuthContext *auth_context)
        /* Leave breadcrumbs if something went wrong,
         * but don't fail the whole operation over it. */
        if (non_fatal_error != NULL) {
+               g_dbus_error_strip_remote_error (non_fatal_error);
                g_warning ("%s: %s", G_STRFUNC, non_fatal_error->message);
                g_error_free (non_fatal_error);
        }
@@ -1621,7 +1623,6 @@ source_registry_authenticate_dismissed_cb (EDBusAuthenticator *dbus_auth,
        }
 
        g_main_loop_quit (auth_context->main_loop);
-       auth_context->success = FALSE;
 }
 
 /* Helper for e_source_registry_authenticate_sync() */
@@ -1638,7 +1639,7 @@ source_registry_call_authenticate_for_source (ESourceRegistry *registry,
        gchar *prompt_title = NULL;
        gchar *prompt_message = NULL;
        gchar *prompt_description = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_object_ref (source);
 
@@ -1685,10 +1686,10 @@ source_registry_call_authenticate_for_source (ESourceRegistry *registry,
                &prompt_message,
                &prompt_description);
 
-       success = e_dbus_source_manager_call_authenticate_sync (
+       e_dbus_source_manager_call_authenticate_sync (
                registry->priv->dbus_source_manager, uid,
                prompt_title, prompt_message, prompt_description,
-               out_object_path, cancellable, error);
+               out_object_path, cancellable, &local_error);
 
        g_free (prompt_title);
        g_free (prompt_message);
@@ -1696,7 +1697,13 @@ source_registry_call_authenticate_for_source (ESourceRegistry *registry,
 
        g_object_unref (source);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /**
@@ -1735,7 +1742,7 @@ e_source_registry_authenticate_sync (ESourceRegistry *registry,
        EDBusAuthenticator *dbus_auth;
        gchar *encryption_key;
        gchar *object_path = NULL;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
        g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
@@ -1744,11 +1751,13 @@ e_source_registry_authenticate_sync (ESourceRegistry *registry,
        /* This extracts authentication prompt details for the ESource
         * before initiating an authentication session with the server,
         * so split it out of the main algorithm for clarity's sake. */
-       success = source_registry_call_authenticate_for_source (
-               registry, auth, source, &object_path, cancellable, error);
+       source_registry_call_authenticate_for_source (
+               registry, auth, source, &object_path,
+               cancellable, &local_error);
 
-       if (!success) {
+       if (local_error != NULL) {
                g_warn_if_fail (object_path == NULL);
+               g_propagate_error (error, local_error);
                return FALSE;
        }
 
@@ -1761,20 +1770,23 @@ e_source_registry_authenticate_sync (ESourceRegistry *registry,
                G_BUS_TYPE_SESSION,
                G_DBUS_PROXY_FLAGS_NONE,
                SOURCES_DBUS_SERVICE_NAME,
-               object_path, cancellable, error);
+               object_path, cancellable, &local_error);
 
        g_free (object_path);
 
-       if (dbus_auth == NULL) {
-               success = FALSE;
+       /* Sanity check. */
+       g_return_val_if_fail (
+               ((dbus_auth != NULL) && (local_error == NULL)) ||
+               ((dbus_auth == NULL) && (local_error != NULL)), FALSE);
+
+       if (local_error != NULL)
                goto exit;
-       }
 
        auth_context = g_slice_new0 (AuthContext);
        auth_context->auth = g_object_ref (auth);
        auth_context->dbus_auth = dbus_auth;  /* takes ownership */
        auth_context->main_loop = g_main_loop_new (main_context, FALSE);
-       auth_context->error = error;
+       auth_context->error = &local_error;
 
        /* This just needs to be something other than
         * E_SOURCE_AUTHENTICATION_ERROR so we don't trip
@@ -1804,15 +1816,13 @@ e_source_registry_authenticate_sync (ESourceRegistry *registry,
         * authentication session.  This must happen AFTER we've
         * connected to the response signal since the server may
         * already have a response ready and waiting for us. */
-       success = e_dbus_authenticator_call_ready_sync (
-               dbus_auth, encryption_key, cancellable, error);
+       e_dbus_authenticator_call_ready_sync (
+               dbus_auth, encryption_key, cancellable, &local_error);
 
        g_free (encryption_key);
 
-       if (success) {
+       if (local_error == NULL)
                g_main_loop_run (auth_context->main_loop);
-               success = auth_context->success;
-       }
 
        auth_context_free (auth_context);
 
@@ -1826,7 +1836,13 @@ exit:
 
        g_main_context_unref (main_context);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /**
@@ -1929,17 +1945,17 @@ source_registry_commit_source_thread (GSimpleAsyncResult *simple,
                                       GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_source_registry_commit_source_sync (
                E_SOURCE_REGISTRY (object),
                async_context->source,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /**
@@ -2100,17 +2116,17 @@ source_registry_create_sources_thread (GSimpleAsyncResult *simple,
                                        GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_source_registry_create_sources_sync (
                E_SOURCE_REGISTRY (object),
                async_context->list_of_sources,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 /* Helper for e_source_registry_create_sources_sync() */
@@ -2185,7 +2201,7 @@ e_source_registry_create_sources_sync (ESourceRegistry *registry,
        GVariant *variant;
        GList *link;
        gulong object_added_id;
-       gboolean success;
+       GError *local_error = NULL;
 
        g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
 
@@ -2225,9 +2241,9 @@ e_source_registry_create_sources_sync (ESourceRegistry *registry,
                create_context);
 
        /* This function sinks the floating GVariant reference. */
-       success = e_dbus_source_manager_call_create_sources_sync (
+       e_dbus_source_manager_call_create_sources_sync (
                registry->priv->dbus_source_manager,
-               variant, cancellable, error);
+               variant, cancellable, &local_error);
 
        g_variant_builder_clear (&builder);
 
@@ -2235,7 +2251,7 @@ e_source_registry_create_sources_sync (ESourceRegistry *registry,
         * But also set a short timeout to avoid getting stuck here in
         * case the registry service adds sources to its orphan table,
         * which prevents them from being exported over D-Bus. */
-       if (success) {
+       if (local_error == NULL) {
                GSource *timeout_source;
 
                timeout_source = g_timeout_source_new_seconds (2);
@@ -2256,7 +2272,13 @@ e_source_registry_create_sources_sync (ESourceRegistry *registry,
        g_main_context_pop_thread_default (create_context->main_context);
        create_context_free (create_context);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /**
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index 5f9d8c8..365974e 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -387,7 +387,7 @@ source_set_property_from_key_file (GObject *object,
 {
        gchar *key;
        GValue *value;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        value = g_slice_new0 (GValue);
        key = e_source_parameter_to_key (pspec->name);
@@ -401,8 +401,8 @@ source_set_property_from_key_file (GObject *object,
                gint v_int;
 
                v_int = g_key_file_get_integer (
-                       key_file, group_name, key, &error);
-               if (error == NULL) {
+                       key_file, group_name, key, &local_error);
+               if (local_error == NULL) {
                        g_value_init (value, G_TYPE_INT);
                        g_value_set_int (value, v_int);
                }
@@ -411,8 +411,8 @@ source_set_property_from_key_file (GObject *object,
                gint64 v_int64;
 
                v_int64 = g_key_file_get_int64 (
-                       key_file, group_name, key, &error);
-               if (error == NULL) {
+                       key_file, group_name, key, &local_error);
+               if (local_error == NULL) {
                        g_value_init (value, G_TYPE_INT64);
                        g_value_set_int64 (value, v_int64);
                }
@@ -422,8 +422,8 @@ source_set_property_from_key_file (GObject *object,
                gchar *v_str;
 
                v_str = g_key_file_get_string (
-                       key_file, group_name, key, &error);
-               if (error == NULL) {
+                       key_file, group_name, key, &local_error);
+               if (local_error == NULL) {
                        v_uint64 = g_ascii_strtoull (v_str, NULL, 16);
 
                        g_value_init (value, G_TYPE_UINT64);
@@ -436,8 +436,8 @@ source_set_property_from_key_file (GObject *object,
                gboolean v_boolean;
 
                v_boolean = g_key_file_get_boolean (
-                       key_file, group_name, key, &error);
-               if (error == NULL) {
+                       key_file, group_name, key, &local_error);
+               if (local_error == NULL) {
                        g_value_init (value, G_TYPE_BOOLEAN);
                        g_value_set_boolean (value, v_boolean);
                }
@@ -446,8 +446,8 @@ source_set_property_from_key_file (GObject *object,
                gchar *nick;
 
                nick = g_key_file_get_string (
-                       key_file, group_name, key, &error);
-               if (error == NULL) {
+                       key_file, group_name, key, &local_error);
+               if (local_error == NULL) {
                        GParamSpecEnum *enum_pspec;
                        GEnumValue *enum_value;
 
@@ -466,8 +466,8 @@ source_set_property_from_key_file (GObject *object,
                gdouble v_double;
 
                v_double = g_key_file_get_double (
-                       key_file, group_name, key, &error);
-               if (error == NULL) {
+                       key_file, group_name, key, &local_error);
+               if (local_error == NULL) {
                        g_value_init (value, G_TYPE_DOUBLE);
                        g_value_set_double (value, v_double);
                }
@@ -477,8 +477,8 @@ source_set_property_from_key_file (GObject *object,
 
                /* Get the localized string if present. */
                v_string = g_key_file_get_locale_string (
-                       key_file, group_name, key, NULL, &error);
-               if (error == NULL) {
+                       key_file, group_name, key, NULL, &local_error);
+               if (local_error == NULL) {
                        g_value_init (value, G_TYPE_STRING);
                        g_value_take_string (value, v_string);
                }
@@ -487,8 +487,8 @@ source_set_property_from_key_file (GObject *object,
                gchar **strv;
 
                strv = g_key_file_get_string_list (
-                       key_file, group_name, key, NULL, &error);
-               if (error == NULL) {
+                       key_file, group_name, key, NULL, &local_error);
+               if (local_error == NULL) {
                        g_value_init (value, G_TYPE_STRV);
                        g_value_take_boxed (value, strv);
                }
@@ -498,8 +498,8 @@ source_set_property_from_key_file (GObject *object,
 
                /* Create the GFile from the URI string. */
                uri = g_key_file_get_locale_string (
-                       key_file, group_name, key, NULL, &error);
-               if (error == NULL) {
+                       key_file, group_name, key, NULL, &local_error);
+               if (local_error == NULL) {
                        GFile *file = NULL;
                        if (uri != NULL && *uri != '\0')
                                file = g_file_new_for_uri (uri);
@@ -516,10 +516,10 @@ source_set_property_from_key_file (GObject *object,
 
        /* If a value could not be retrieved from the key
         * file, restore the property to its default value. */
-       if (error != NULL) {
+       if (local_error != NULL) {
                g_value_init (value, pspec->value_type);
                g_param_value_set_default (pspec, value);
-               g_error_free (error);
+               g_error_free (local_error);
        }
 
        if (G_IS_VALUE (value)) {
@@ -646,17 +646,18 @@ source_notify_dbus_data_cb (EDBusSource *dbus_source,
                             GParamSpec *pspec,
                             ESource *source)
 {
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        g_rec_mutex_lock (&source->priv->lock);
 
        /* Since the source data came from a GKeyFile structure on the
         * server-side, this should never fail.  But we'll print error
         * messages to the terminal just in case. */
-       if (!source_parse_dbus_data (source, &error)) {
-               g_return_if_fail (error != NULL);
-               g_warning ("%s", error->message);
-               g_error_free (error);
+       source_parse_dbus_data (source, &local_error);
+
+       if (local_error != NULL) {
+               g_warning ("%s", local_error->message);
+               g_error_free (local_error);
        }
 
        g_rec_mutex_unlock (&source->priv->lock);
@@ -926,7 +927,7 @@ source_remove_sync (ESource *source,
 {
        EDBusSourceRemovable *dbus_interface = NULL;
        GDBusObject *dbus_object;
-       gboolean success;
+       GError *local_error = NULL;
 
        dbus_object = e_source_ref_dbus_object (source);
        if (dbus_object != NULL) {
@@ -945,12 +946,18 @@ source_remove_sync (ESource *source,
                return FALSE;
        }
 
-       success = e_dbus_source_removable_call_remove_sync (
-               dbus_interface, cancellable, error);
+       e_dbus_source_removable_call_remove_sync (
+               dbus_interface, cancellable, &local_error);
 
        g_object_unref (dbus_interface);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for source_remove() */
@@ -959,12 +966,12 @@ source_remove_thread (GSimpleAsyncResult *simple,
                       GObject *object,
                       GCancellable *cancellable)
 {
-       GError *error = NULL;
+       GError *local_error = NULL;
 
-       e_source_remove_sync (E_SOURCE (object), cancellable, &error);
+       e_source_remove_sync (E_SOURCE (object), cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 static void
@@ -1011,8 +1018,8 @@ source_write_sync (ESource *source,
 {
        EDBusSourceWritable *dbus_interface = NULL;
        GDBusObject *dbus_object;
-       gboolean success;
        gchar *data;
+       GError *local_error = NULL;
 
        dbus_object = e_source_ref_dbus_object (source);
        if (dbus_object != NULL) {
@@ -1033,14 +1040,20 @@ source_write_sync (ESource *source,
 
        data = e_source_to_string (source, NULL);
 
-       success = e_dbus_source_writable_call_write_sync (
-               dbus_interface, data, cancellable, error);
+       e_dbus_source_writable_call_write_sync (
+               dbus_interface, data, cancellable, &local_error);
 
        g_free (data);
 
        g_object_unref (dbus_interface);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for source_write() */
@@ -1049,12 +1062,12 @@ source_write_thread (GSimpleAsyncResult *simple,
                      GObject *object,
                      GCancellable *cancellable)
 {
-       GError *error = NULL;
+       GError *local_error = NULL;
 
-       e_source_write_sync (E_SOURCE (object), cancellable, &error);
+       e_source_write_sync (E_SOURCE (object), cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 static void
@@ -1103,7 +1116,7 @@ source_remote_create_sync (ESource *source,
        EDBusSourceRemoteCreatable *dbus_interface = NULL;
        GDBusObject *dbus_object;
        gchar *uid, *data;
-       gboolean success;
+       GError *local_error = NULL;
 
        dbus_object = e_source_ref_dbus_object (source);
        if (dbus_object != NULL) {
@@ -1126,15 +1139,21 @@ source_remote_create_sync (ESource *source,
        uid = e_source_dup_uid (scratch_source);
        data = e_source_to_string (scratch_source, NULL);
 
-       success = e_dbus_source_remote_creatable_call_create_sync (
-               dbus_interface, uid, data, cancellable, error);
+       e_dbus_source_remote_creatable_call_create_sync (
+               dbus_interface, uid, data, cancellable, &local_error);
 
        g_free (data);
        g_free (uid);
 
        g_object_unref (dbus_interface);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for source_remote_create() */
@@ -1144,17 +1163,17 @@ source_remote_create_thread (GSimpleAsyncResult *simple,
                              GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
        e_source_remote_create_sync (
                E_SOURCE (object),
                async_context->scratch_source,
-               cancellable, &error);
+               cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 static void
@@ -1210,7 +1229,7 @@ source_remote_delete_sync (ESource *source,
 {
        EDBusSourceRemoteDeletable *dbus_interface = NULL;
        GDBusObject *dbus_object;
-       gboolean success;
+       GError *local_error = NULL;
 
        dbus_object = e_source_ref_dbus_object (source);
        if (dbus_object != NULL) {
@@ -1230,12 +1249,18 @@ source_remote_delete_sync (ESource *source,
                return FALSE;
        }
 
-       success = e_dbus_source_remote_deletable_call_delete_sync (
-               dbus_interface, cancellable, error);
+       e_dbus_source_remote_deletable_call_delete_sync (
+               dbus_interface, cancellable, &local_error);
 
        g_object_unref (dbus_interface);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for source_remote_delete() */
@@ -1244,13 +1269,13 @@ source_remote_delete_thread (GSimpleAsyncResult *simple,
                              GObject *object,
                              GCancellable *cancellable)
 {
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        e_source_remote_delete_sync (
-               E_SOURCE (object), cancellable, &error);
+               E_SOURCE (object), cancellable, &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 static void
@@ -1300,7 +1325,7 @@ source_get_oauth2_access_token_sync (ESource *source,
 {
        EDBusSourceOAuth2Support *dbus_interface = NULL;
        GDBusObject *dbus_object;
-       gboolean success;
+       GError *local_error = NULL;
 
        dbus_object = e_source_ref_dbus_object (source);
        if (dbus_object != NULL) {
@@ -1320,13 +1345,19 @@ source_get_oauth2_access_token_sync (ESource *source,
                return FALSE;
        }
 
-       success = e_dbus_source_oauth2_support_call_get_access_token_sync (
+       e_dbus_source_oauth2_support_call_get_access_token_sync (
                dbus_interface, out_access_token,
-               out_expires_in, cancellable, error);
+               out_expires_in, cancellable, &local_error);
 
        g_object_unref (dbus_interface);
 
-       return success;
+       if (local_error != NULL) {
+               g_dbus_error_strip_remote_error (local_error);
+               g_propagate_error (error, local_error);
+               return FALSE;
+       }
+
+       return TRUE;
 }
 
 /* Helper for source_get_oauth2_access_token() */
@@ -1336,7 +1367,7 @@ source_get_oauth2_access_token_thread (GSimpleAsyncResult *simple,
                                        GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       GError *error = NULL;
+       GError *local_error = NULL;
 
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
 
@@ -1344,10 +1375,10 @@ source_get_oauth2_access_token_thread (GSimpleAsyncResult *simple,
                E_SOURCE (object), cancellable,
                &async_context->access_token,
                &async_context->expires_in,
-               &error);
+               &local_error);
 
-       if (error != NULL)
-               g_simple_async_result_take_error (simple, error);
+       if (local_error != NULL)
+               g_simple_async_result_take_error (simple, local_error);
 }
 
 static void


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