[tracker/journal-err-reporting: 5/7] libtracker-data: Adding comments explaining error handling actions



commit 7487926e86345f09b385e1437fabe6b9b85e93e0
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Apr 22 11:34:43 2011 +0200

    libtracker-data: Adding comments explaining error handling actions

 src/libtracker-data/tracker-data-manager.c |    8 +++++---
 src/libtracker-data/tracker-db-journal.c   |    5 +++++
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 2f83173..36fa618 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -3556,7 +3556,7 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 	iface = tracker_db_manager_get_db_interface ();
 
 	if (journal_check && is_first_time_index) {
-		/* Call may fail without notice */
+		/* Call may fail without notice (it's handled) */
 		if (tracker_db_journal_reader_init (NULL, NULL)) {
 			if (tracker_db_journal_reader_next (NULL)) {
 				/* journal with at least one valid transaction
@@ -4131,7 +4131,8 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 			if (g_error_matches (internal_error, TRACKER_DB_INTERFACE_ERROR, TRACKER_DB_NO_SPACE)) {
 				tracker_db_manager_remove_all (FALSE);
 				tracker_db_manager_shutdown ();
-				/* Call may fail without notice, we're in error handling already */
+				/* Call may fail without notice, we're in error handling already.
+				 * When fails it means that close() of journal file failed. */
 				tracker_db_journal_shutdown (NULL);
 			}
 
@@ -4206,7 +4207,8 @@ tracker_data_manager_shutdown (void)
 
 	if (error) {
 		/* TODO: propagate error */
-		g_warning ("%s", error->message);
+		g_warning ("While shutting down journal %s",
+		           error->message ? error->message : "No error given");
 		g_error_free (error);
 	}
 
diff --git a/src/libtracker-data/tracker-db-journal.c b/src/libtracker-data/tracker-db-journal.c
index e0fb512..4593e24 100644
--- a/src/libtracker-data/tracker-db-journal.c
+++ b/src/libtracker-data/tracker-db-journal.c
@@ -477,6 +477,8 @@ db_journal_init_file (JournalWriter  *jwriter,
 
 		/* If it didn't expand properly */
 		if (jwriter->cur_block == NULL) {
+			/* Q: Should we set error with out of memory here? When adding error
+			 * reporting there where no warnings or criticals here. */
 			g_free (jwriter->journal_filename);
 			jwriter->journal_filename = NULL;
 			return FALSE;
@@ -492,6 +494,9 @@ db_journal_init_file (JournalWriter  *jwriter,
 		jwriter->cur_block[7] = '4';
 
 		if (!write_all_data (jwriter->journal, jwriter->cur_block, 8)) {
+			/* Q: Can't write 8 bytes to the file, should we set error with out
+			 * of diskspace here? When adding error reporting there where no
+			 * warnings or criticals here. */
 			g_free (jwriter->journal_filename);
 			jwriter->journal_filename = NULL;
 			return FALSE;



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