summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrever Fischer <tdfischer@fedoraproject.org>2012-03-26 17:06:03 (GMT)
committerTrever Fischer <tdfischer@fedoraproject.org>2012-03-26 17:06:03 (GMT)
commit69645a411a7993814ef4849cc30106141bfe85ca (patch)
tree417df3c5f52356390db8e14d691ad306e7ef2ce6
parentafff91b26b3f8bde2a7ec7de2465cf15f0be4f7a (diff)
warning--
-rw-r--r--extensions/blacklist.vala14
-rw-r--r--extensions/ds-registry.vala17
-rw-r--r--extensions/fts++/zeitgeist-fts.vala4
-rw-r--r--extensions/storage-monitor.vala14
-rw-r--r--src/datamodel.vala2
-rw-r--r--src/remote.vala2
6 files changed, 36 insertions, 17 deletions
diff --git a/extensions/blacklist.vala b/extensions/blacklist.vala
index 23034e3..e842cac 100644
--- a/extensions/blacklist.vala
+++ b/extensions/blacklist.vala
@@ -47,7 +47,7 @@ namespace Zeitgeist
private const string SIG_BLACKLIST = "a{s("+Utils.SIG_EVENT+")}";
private static HashTable<string, Event> from_variant (
- Variant templates_variant)
+ Variant templates_variant) throws EngineError
{
var blacklist = new HashTable<string, Event> (str_hash, str_equal);
@@ -99,10 +99,16 @@ namespace Zeitgeist
// Restore previous blacklist from database, or create an empty one
Variant? templates = retrieve_config ("blacklist",
BlacklistTemplates.SIG_BLACKLIST);
- if (templates != null)
- blacklist = BlacklistTemplates.from_variant (templates);
- else
+ if (templates != null) {
+ try {
+ blacklist = BlacklistTemplates.from_variant (templates);
+ } catch (EngineError e) {
+ warning ("Could not load blacklist from variant: %s", e.message);
+ blacklist = new HashTable<string, Event> (str_hash, str_equal);
+ }
+ } else {
blacklist = new HashTable<string, Event> (str_hash, str_equal);
+ }
// This will be called after bus is acquired, so it shouldn't block
try
diff --git a/extensions/ds-registry.vala b/extensions/ds-registry.vala
index c651d03..359d1b2 100644
--- a/extensions/ds-registry.vala
+++ b/extensions/ds-registry.vala
@@ -72,7 +72,7 @@ namespace Zeitgeist
}
public DataSource.from_variant (Variant variant,
- bool reset_running=false)
+ bool reset_running=false) throws EngineError
{
warn_if_fail (
variant.get_type_string () == "(sssa("+Utils.SIG_EVENT+")bxb)"
@@ -127,7 +127,7 @@ namespace Zeitgeist
"a(sssa("+Utils.SIG_EVENT+")bxb)";
private static HashTable<string, DataSource> from_variant (
- Variant sources_variant, bool reset_running=false)
+ Variant sources_variant, bool reset_running=false) throws EngineError
{
var registry = new HashTable<string, DataSource> (
str_hash, str_equal);
@@ -185,11 +185,16 @@ namespace Zeitgeist
Variant? registry = retrieve_config ("registry",
DataSources.SIG_DATASOURCES);
- if (registry != null)
- sources = DataSources.from_variant (registry, true);
- else
+ if (registry != null) {
+ try {
+ sources = DataSources.from_variant (registry, true);
+ } catch (EngineError e) {
+ warning ("Error while loading datasource registry: %s", e.message);
+ }
+ } else {
sources = new HashTable<string, DataSource> (
str_hash, str_equal);
+ }
// this will be called after bus is acquired, so it shouldn't block
try
@@ -249,7 +254,7 @@ namespace Zeitgeist
}
public bool register_data_source (string unique_id, string name,
- string description, Variant event_templates, BusName? sender)
+ string description, Variant event_templates, BusName? sender) throws EngineError
{
debug ("%s: %s, %s, %s", Log.METHOD, unique_id, name, description);
if (sender == null)
diff --git a/extensions/fts++/zeitgeist-fts.vala b/extensions/fts++/zeitgeist-fts.vala
index 79bc190..72cd8d4 100644
--- a/extensions/fts++/zeitgeist-fts.vala
+++ b/extensions/fts++/zeitgeist-fts.vala
@@ -99,7 +99,7 @@ namespace Zeitgeist
}
public async void notify_insert (Variant time_range, Variant events)
- throws IOError
+ throws IOError, EngineError
{
debug ("got insertion notification");
var events_arr = Events.from_variant (events);
@@ -177,7 +177,7 @@ namespace Zeitgeist
var proxy = connection.get_proxy_sync<RemoteDBus> (
"org.freedesktop.DBus", "/org/freedesktop/DBus",
DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
- bool zeitgeist_up = proxy.name_has_owner (ZEITGEIST_DBUS_NAME);
+ // bool zeitgeist_up = proxy.name_has_owner (ZEITGEIST_DBUS_NAME);
// FIXME: throw an error that zeitgeist isn't up? or just start it?
bool name_owned = proxy.name_has_owner (DBUS_NAME);
if (name_owned)
diff --git a/extensions/storage-monitor.vala b/extensions/storage-monitor.vala
index 950377d..6577f10 100644
--- a/extensions/storage-monitor.vala
+++ b/extensions/storage-monitor.vala
@@ -377,7 +377,11 @@ namespace Zeitgeist
update_storage_medium_stmt.bind_text (3, display_name);
update_storage_medium_stmt.bind_text (4, medium_name);
int rc = update_storage_medium_stmt.step ();
- database.assert_query_success (rc, "add_storage_medium", Sqlite.DONE);
+ try {
+ database.assert_query_success (rc, "add_storage_medium", Sqlite.DONE);
+ } catch (EngineError e) {
+ warning ("Could not add storage medium: %s", e.message);
+ }
}
storage_available (medium_name, StorageMedia.to_variant (
medium_name, true, icon, display_name));
@@ -395,8 +399,12 @@ namespace Zeitgeist
update_medium_state_stmt.bind_int (1, 0);
update_medium_state_stmt.bind_text (2, medium_name);
int rc = update_medium_state_stmt.step ();
- database.assert_query_success (rc, "remove_storage_medium",
- Sqlite.DONE);
+ try {
+ database.assert_query_success (rc, "remove_storage_medium",
+ Sqlite.DONE);
+ } catch (EngineError e) {
+ warning ("Could not remove storage medium: %s", e.message);
+ }
}
storage_unavailable (medium_name);
}
diff --git a/src/datamodel.vala b/src/datamodel.vala
index 16215d4..edfc54c 100644
--- a/src/datamodel.vala
+++ b/src/datamodel.vala
@@ -76,7 +76,7 @@ namespace Zeitgeist
}
public TimeRange.from_variant (Variant variant)
- throws EngineError.INVALID_SIGNATURE
+ throws EngineError
{
assert_sig (variant.get_type_string () == "(xx)",
"Invalid D-Bus signature.");
diff --git a/src/remote.vala b/src/remote.vala
index 9c78052..af3e5bc 100644
--- a/src/remote.vala
+++ b/src/remote.vala
@@ -101,7 +101,7 @@ namespace Zeitgeist
public async abstract void notify_insert (
[DBus (signature = "(xx)")] Variant time_range,
[DBus (signature = "a(asaasay)")] Variant events
- ) throws IOError;
+ ) throws IOError, EngineError;
public async abstract void notify_delete (
[DBus (signature = "(xx)")] Variant time_range,