[tracker/journal-err-reporting: 7/7] libtracker-data: Add comments and warnings at error handling points



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

    libtracker-data: Add comments and warnings at error handling points

 src/libtracker-data/tracker-data-update.c |   12 ++++++++----
 src/libtracker-data/tracker-db-journal.c  |    2 +-
 src/libtracker-data/tracker-db-manager.c  |    4 +++-
 3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 7560e06..e65bd16 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2964,6 +2964,7 @@ tracker_data_begin_transaction (GError **error)
 			tracker_db_journal_start_ontology_transaction (resource_time, &n_error);
 
 			if (n_error) {
+				/* Q: Should we do a tracker_data_rollback_transaction () here? */
 				tracker_db_interface_end_db_transaction (iface, NULL);
 				g_propagate_error (error, n_error);
 				return;
@@ -3115,7 +3116,9 @@ tracker_data_rollback_transaction (void)
 
 		if (ignorable) {
 			/* Not sure if this is also ignorable: it's the close() of the
-			 * journal file failing. */
+			 * journal file failing (in case of TRANSACTION_FORMAT_ONTOLOGY) */
+			g_warning ("Error ignored while rolling back transaction in journal: %s",
+			           ignorable->message ? ignorable->message : "No error given");
 			g_error_free (ignorable);
 		}
 
@@ -3216,7 +3219,8 @@ tracker_data_replay_journal (TrackerBusyCallback   busy_callback,
 
 	tracker_db_journal_reader_init (NULL, &n_error);
 	if (n_error) {
-		/* This is fatal */
+		/* This is fatal (doesn't happen when file doesn't exist, does happen
+		 * when for some other reason the reader can't be created) */
 		g_propagate_error (error, n_error);
 		return;
 	}
@@ -3482,7 +3486,7 @@ tracker_data_replay_journal (TrackerBusyCallback   busy_callback,
 
 		tracker_db_journal_init (NULL, FALSE, &n_error);
 		if (n_error) {
-			/* This is fatal */
+			/* This is fatal (journal file not writable, etc) */
 			g_propagate_error (error, n_error);
 			return;
 		}
@@ -3490,7 +3494,7 @@ tracker_data_replay_journal (TrackerBusyCallback   busy_callback,
 		tracker_db_journal_shutdown (&n_error);
 
 		if (n_error) {
-			/* This is fatal */
+			/* This is fatal (close of journal file failed after truncate) */
 			g_propagate_error (error, n_error);
 			return;
 		}
diff --git a/src/libtracker-data/tracker-db-journal.c b/src/libtracker-data/tracker-db-journal.c
index 4593e24..890d6f3 100644
--- a/src/libtracker-data/tracker-db-journal.c
+++ b/src/libtracker-data/tracker-db-journal.c
@@ -1208,7 +1208,7 @@ tracker_db_journal_commit_db_transaction (GError **error)
 #endif /* GLib check */
 	}
 
-	/* Only report the first error here */
+	/* Coalesces the two error reports: */
 	if (n_error) {
 		g_propagate_error (error, n_error);
 		if (nn_error) {
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 3427eb6..67bec64 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -410,7 +410,9 @@ db_manager_remove_journal (void)
 	tracker_db_journal_shutdown (&error);
 
 	if (error) {
-		g_message ("%s", error->message);
+		/* TODO: propagate error */
+		g_message ("Ignored error while shutting down journal during remove: %s",
+		           error->message ? error->message : "No error given");
 		g_error_free (error);
 	}
 



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