From: <dg...@su...> - 2009-01-11 00:26:24
|
Author: ianmartin Date: Sun Jan 11 01:25:45 2009 New Revision: 5087 URL: http://www.opensync.org/changeset/5087 Log: Add error handling to sync_done functions Modified: plugins/evolution2/src/evolution2_ebook.c plugins/evolution2/src/evolution2_ecal.c Modified: plugins/evolution2/src/evolution2_ebook.c ============================================================================== --- plugins/evolution2/src/evolution2_ebook.c Sun Jan 11 01:19:29 2009 (r5086) +++ plugins/evolution2/src/evolution2_ebook.c Sun Jan 11 01:25:45 2009 (r5087) @@ -180,6 +180,8 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); OSyncEvoEnv *env = (OSyncEvoEnv *)data; + OSyncError *error = NULL; + GError *gerror=NULL; char *anchorpath = g_strdup_printf("%s/anchor.db", osync_plugin_info_get_configdir(info)); osync_anchor_update(anchorpath, "contact", env->addressbook_path); @@ -187,8 +189,15 @@ GList *changes = NULL; - e_book_get_changes(env->addressbook, env->change_id, &changes, NULL); - + if (!e_book_get_changes(env->addressbook, env->change_id, &changes, &gerror)) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "Unable to update EBook time of last sync: %s", gerror ? gerror->message : "None"); + g_clear_error(&gerror); + osync_context_report_osyncerror(ctx, error); + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); + osync_error_unref(&error); + } + + e_book_free_change_list(changes); osync_context_report_success(ctx); osync_trace(TRACE_EXIT, "%s", __func__); Modified: plugins/evolution2/src/evolution2_ecal.c ============================================================================== --- plugins/evolution2/src/evolution2_ecal.c Sun Jan 11 01:19:29 2009 (r5086) +++ plugins/evolution2/src/evolution2_ecal.c Sun Jan 11 01:25:45 2009 (r5087) @@ -19,6 +19,7 @@ */ #include <string.h> +#include <glib.h> #include <opensync/opensync.h> #include <opensync/opensync-context.h> @@ -133,6 +134,8 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); OSyncEvoEnv *env = (OSyncEvoEnv *)data; + OSyncError *error = NULL; + GError *gerror = NULL; OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)osync_objtype_sink_get_userdata(sink); @@ -143,8 +146,15 @@ GList *changes = NULL; - e_cal_get_changes(evo_cal->calendar, env->change_id, &changes, NULL); - + if (!e_cal_get_changes(evo_cal->calendar, env->change_id, &changes, &gerror)) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "Unable to update %s ECal time of last sync: %s", evo_cal->objtype, gerror ? gerror->message : "None"); + g_clear_error(&gerror); + osync_context_report_osyncerror(ctx, error); + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); + osync_error_unref(&error); + } + + e_cal_free_change_list(changes); osync_context_report_success(ctx); osync_trace(TRACE_EXIT, "%s", __func__); |