[tracker] tracker-store: Improve Data.Manager.init error handling



commit a3495eb1346ba867c2d25336abd2f0652b05907e
Author: Jürg Billeter <j bitron ch>
Date:   Mon May 16 10:48:31 2011 +0200

    tracker-store: Improve Data.Manager.init error handling
    
    The only noticeable difference is that exit code was 0 when journal
    error was encountered during initialization.

 src/libtracker-data/libtracker-data.vapi |   11 ++++++++++-
 src/tracker-store/tracker-main.vala      |    2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/libtracker-data.vapi b/src/libtracker-data/libtracker-data.vapi
index e9ef977..fe3b9b8 100644
--- a/src/libtracker-data/libtracker-data.vapi
+++ b/src/libtracker-data/libtracker-data.vapi
@@ -36,6 +36,15 @@ namespace Tracker {
 		NO_SPACE
 	}
 
+	[CCode (cheader_filename = "libtracker-data/tracker-db-journal.h")]
+	public errordomain DBJournalError {
+		UNKNOWN,
+		DAMAGED_JOURNAL_ENTRY,
+		COULD_NOT_WRITE,
+		COULD_NOT_CLOSE,
+		BEGIN_OF_JOURNAL
+	}
+
 	[CCode (cprefix = "TRACKER_DATA_BACKUP_ERROR_", cheader_filename = "libtracker-data/tracker-data-backup.h")]
 	public errordomain DataBackupError {
 		INVALID_URI
@@ -210,7 +219,7 @@ namespace Tracker {
 
 	[CCode (cheader_filename = "libtracker-data/tracker-data-manager.h")]
 	namespace Data.Manager {
-		public bool init (DBManagerFlags flags, [CCode (array_length = false)] string[]? test_schema, out bool first_time, bool journal_check, uint select_cache_size, uint update_cache_size, BusyCallback? busy_callback, string? busy_status) throws DBInterfaceError;
+		public bool init (DBManagerFlags flags, [CCode (array_length = false)] string[]? test_schema, out bool first_time, bool journal_check, uint select_cache_size, uint update_cache_size, BusyCallback? busy_callback, string? busy_status) throws DBInterfaceError, DBJournalError;
 		public void shutdown ();
 	}
 
diff --git a/src/tracker-store/tracker-main.vala b/src/tracker-store/tracker-main.vala
index 6bc1977..768ed27 100644
--- a/src/tracker-store/tracker-main.vala
+++ b/src/tracker-store/tracker-main.vala
@@ -282,7 +282,7 @@ License which can be viewed at:
 			                           update_cache_size,
 			                           busy_callback,
 			                           "Initializing");
-		} catch (Tracker.DBInterfaceError e) {
+		} catch (GLib.Error e) {
 			critical ("Cannot initialize database: %s", e.message);
 			return 1;
 		}



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