[tracker/direct-access: 25/38] libtracker-direct: Handle initialization failure
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/direct-access: 25/38] libtracker-direct: Handle initialization failure
- Date: Mon, 16 Aug 2010 12:17:48 +0000 (UTC)
commit ee2c442942b73699833620638fe875c280e86205
Author: Jürg Billeter <j bitron ch>
Date: Wed Jul 21 16:59:12 2010 +0200
libtracker-direct: Handle initialization failure
src/libtracker-direct/tracker-direct.vala | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-direct/tracker-direct.vala b/src/libtracker-direct/tracker-direct.vala
index 32953ae..d1cd63e 100644
--- a/src/libtracker-direct/tracker-direct.vala
+++ b/src/libtracker-direct/tracker-direct.vala
@@ -21,10 +21,12 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
// only single connection is currently supported per process
static bool initialized;
- public Connection ()
+ public Connection () throws Sparql.Error
requires (!initialized) {
initialized = true;
- Data.Manager.init (DBManagerFlags.READONLY, null, null, false, null, null);
+ if (!Data.Manager.init (DBManagerFlags.READONLY, null, null, false, null, null)) {
+ throw new Sparql.Error.INTERNAL ("Unable to initialize database");
+ }
}
~Connection () {
@@ -52,7 +54,11 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
}
}
-public Tracker.Sparql.Connection module_init () {
- Tracker.Sparql.Connection plugin = new Tracker.Direct.Connection ();
- return plugin;
+public Tracker.Sparql.Connection? module_init () {
+ try {
+ Tracker.Sparql.Connection plugin = new Tracker.Direct.Connection ();
+ return plugin;
+ } catch (Tracker.Sparql.Error e) {
+ return null;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]