[tracker/journal-err-reporting: 4/7] libtracker-data: Fixup error reporting in backup-restore code



commit a2439a22188a14eaaa78727c85a5570f8e8f41ed
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Apr 22 11:17:38 2011 +0200

    libtracker-data: Fixup error reporting in backup-restore code

 src/libtracker-data/tracker-data-backup.c |   30 ++++++++++++++++------------
 1 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index 12665ad..8bf0844 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -337,6 +337,7 @@ tracker_data_backup_restore (GFile                *journal,
 		gchar **argv;
 		gint exit_status;
 		guint select_cache_size, update_cache_size;
+		GError *n_error = NULL;
 
 		flags = tracker_db_manager_get_flags (&select_cache_size, &update_cache_size);
 
@@ -378,12 +379,17 @@ tracker_data_backup_restore (GFile                *journal,
 		g_strfreev (argv);
 
 		tracker_db_manager_init_locations ();
-		tracker_db_journal_init (NULL, FALSE, &internal_error);
-
-		if (internal_error) {
-			tracker_db_manager_restore_from_temp ();
-			g_propagate_error (error, internal_error);
-			goto handler;
+		tracker_db_journal_init (NULL, FALSE, &n_error);
+
+		if (n_error) {
+			if (!info->error) {
+				g_propagate_error (&info->error, n_error);
+			} else {
+				g_warning ("Ignored error while initializing journal during backup (another higher priority error already took place): %s",
+				           n_error->message ? n_error->message : "No error given");
+				g_error_free (n_error);
+			}
+			n_error = NULL;
 		}
 
 		if (info->error) {
@@ -392,12 +398,12 @@ tracker_data_backup_restore (GFile                *journal,
 			tracker_db_manager_remove_temp ();
 		}
 
-		tracker_db_journal_shutdown (&internal_error);
+		tracker_db_journal_shutdown (&n_error);
 
-		if (internal_error) {
-			tracker_db_manager_restore_from_temp ();
-			g_propagate_error (error, internal_error);
-			goto handler;
+		if (n_error) {
+			g_warning ("Ignored error while shuting down journal during backup: %s",
+			           n_error->message ? n_error->message : "No error given");
+			g_error_free (n_error);
 		}
 
 		tracker_data_manager_init (flags, test_schemas, &is_first, TRUE,
@@ -428,8 +434,6 @@ tracker_data_backup_restore (GFile                *journal,
 		info->error = NULL;
 	}
 
-handler:
-
 	free_backup_save_info (info);
 }
 



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