------------------------------------------------------------ revno: 298 committer: Michal Hruby <michal....@gmail.com> branch nick: bb-fts timestamp: Tue 2011-10-11 18:34:37 +0200 message: Throw exception all the way up to Engine modified: src/sql-schema.vala src/zeitgeist-daemon.vala
-- lp:~zeitgeist/zeitgeist/bluebird https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird Your team Zeitgeist Framework Team is subscribed to branch lp:~zeitgeist/zeitgeist/bluebird. To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'src/sql-schema.vala' --- src/sql-schema.vala 2011-09-21 17:14:36 +0000 +++ src/sql-schema.vala 2011-10-11 16:34:37 +0000 @@ -33,6 +33,7 @@ { public static void ensure_schema (Sqlite.Database database) + throws EngineError { // TODO: PRAGMA: WAL @@ -44,6 +45,7 @@ } public static void create_schema (Sqlite.Database database) + throws EngineError { // URI exec_query (database, """ @@ -354,16 +356,15 @@ * @param sql the SQL query to run */ private static void exec_query (Sqlite.Database database, - string sql) + string sql) throws EngineError { int rc = database.exec (sql); if (rc != Sqlite.OK) { - string error_message = "Can't create database: %d, %s".printf( - rc, database.errmsg ()); - critical ("%s\n", error_message); - // FIXME: Propagate exceptions so the engine will stop if - // this happens + const string fmt_str = "Can't create database: %d, %s\n\n" + + "Unable to execute SQL:\n%s"; + var err_msg = fmt_str.printf (rc, database.errmsg (), sql); + throw new EngineError.DATABASE_ERROR (err_msg); } } === modified file 'src/zeitgeist-daemon.vala' --- src/zeitgeist-daemon.vala 2011-10-11 14:54:27 +0000 +++ src/zeitgeist-daemon.vala 2011-10-11 16:34:37 +0000 @@ -112,17 +112,9 @@ } } - public Daemon () + public Daemon () throws EngineError { - try - { - engine = new Engine (); - } - catch (EngineError e) - { - safe_exit (); - } - + engine = new Engine (); notifications = new MonitorManager (); } @@ -251,16 +243,21 @@ } } - static void on_bus_aquired (DBusConnection conn) + static void on_bus_acquired (DBusConnection conn) { - instance = new Daemon (); try { + instance = new Daemon (); instance.register_dbus_object (conn); } + catch (EngineError err) + { + critical ("%s", err.message); + mainloop.quit (); + } catch (IOError e) { - stderr.printf ("Could not register service\n"); + critical ("Could not register service"); } } @@ -343,7 +340,7 @@ owner_id = Bus.own_name (BusType.SESSION, "org.gnome.zeitgeist.Engine", BusNameOwnerFlags.NONE, - on_bus_aquired, + on_bus_acquired, name_acquired_callback, name_lost_callback);
_______________________________________________ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp