[rygel] core,plugins: Catch correct error from DBus calls
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core,plugins: Catch correct error from DBus calls
- Date: Fri, 17 Jun 2011 00:20:06 +0000 (UTC)
commit 49a4e1fb0e2b063c365a7a91bd1694bc83cb2f5e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Jun 17 03:18:16 2011 +0300
core,plugins: Catch correct error from DBus calls
Apparently we get a DBusError rather than IOError from DBus calls.
.../external/rygel-external-album-art-factory.vala | 3 ++-
.../external/rygel-external-icon-factory.vala | 2 +-
.../external/rygel-external-interfaces.vala | 8 ++++----
.../external/rygel-external-item-factory.vala | 10 +++++-----
.../external/rygel-external-plugin-factory.vala | 15 ++++++++-------
.../external/rygel-external-thumbnail-factory.vala | 2 +-
src/plugins/mpris/rygel-mpris-interfaces.vala | 12 ++++++------
src/plugins/mpris/rygel-mpris-plugin-factory.vala | 4 ++--
.../tracker/rygel-tracker-deletion-query.vala | 2 +-
.../tracker/rygel-tracker-insertion-query.vala | 2 +-
src/plugins/tracker/rygel-tracker-interfaces.vala | 10 +++++-----
.../tracker/rygel-tracker-metadata-values.vala | 2 +-
.../tracker/rygel-tracker-plugin-factory.vala | 4 ++--
src/plugins/tracker/rygel-tracker-query.vala | 2 +-
.../tracker/rygel-tracker-selection-query.vala | 2 +-
src/rygel/rygel-dbus-service.vala | 2 +-
src/rygel/rygel-free-desktop-interfaces.vala | 10 +++++-----
17 files changed, 47 insertions(+), 45 deletions(-)
---
diff --git a/src/plugins/external/rygel-external-album-art-factory.vala b/src/plugins/external/rygel-external-album-art-factory.vala
index 5a9b662..e523c54 100644
--- a/src/plugins/external/rygel-external-album-art-factory.vala
+++ b/src/plugins/external/rygel-external-album-art-factory.vala
@@ -29,7 +29,8 @@ using FreeDesktop;
*/
public class Rygel.External.AlbumArtFactory {
public async Thumbnail create (string service_name,
- string object_path) throws IOError {
+ string object_path)
+ throws IOError, DBusError {
Properties props = yield Bus.get_proxy
(BusType.SESSION,
service_name,
diff --git a/src/plugins/external/rygel-external-icon-factory.vala b/src/plugins/external/rygel-external-icon-factory.vala
index a291cdf..9b9651d 100644
--- a/src/plugins/external/rygel-external-icon-factory.vala
+++ b/src/plugins/external/rygel-external-icon-factory.vala
@@ -29,7 +29,7 @@ public class Rygel.External.IconFactory {
public async IconInfo? create (string service_name,
HashTable<string,Variant> container_props)
- throws IOError {
+ throws IOError, DBusError {
var value = container_props.lookup ("Icon");
if (value == null) {
// Seems no icon is provided, nevermind
diff --git a/src/plugins/external/rygel-external-interfaces.vala b/src/plugins/external/rygel-external-interfaces.vala
index a957a85..097cc14 100644
--- a/src/plugins/external/rygel-external-interfaces.vala
+++ b/src/plugins/external/rygel-external-interfaces.vala
@@ -51,22 +51,22 @@ public interface Rygel.External.MediaContainerProxy : DBusProxy,
public abstract async HashTable<string,Variant>[] list_children
(uint offset,
uint max_count,
- string[] filter) throws IOError;
+ string[] filter) throws DBusError;
public abstract async HashTable<string,Variant>[] list_containers
(uint offset,
uint max_count,
- string[] filter) throws IOError;
+ string[] filter) throws DBusError;
public abstract async HashTable<string,Variant>[] list_items
(uint offset,
uint max_count,
- string[] filter) throws IOError;
+ string[] filter) throws DBusError;
// Optional API
public abstract async HashTable<string,Variant>[] search_objects
(string query,
uint offset,
uint max_count,
- string[] filter) throws IOError;
+ string[] filter) throws DBusError;
public abstract ObjectPath icon { owned get; set; }
}
diff --git a/src/plugins/external/rygel-external-item-factory.vala b/src/plugins/external/rygel-external-item-factory.vala
index 6a607d8..b2a169a 100644
--- a/src/plugins/external/rygel-external-item-factory.vala
+++ b/src/plugins/external/rygel-external-item-factory.vala
@@ -35,7 +35,7 @@ public class Rygel.External.ItemFactory {
HashTable<string,Variant> props,
string service_name,
MediaContainer parent)
- throws GLib.Error {
+ throws IOError, DBusError {
MediaItem item;
if (type.has_prefix ("audio")) {
@@ -75,7 +75,7 @@ public class Rygel.External.ItemFactory {
(MusicItem music,
HashTable<string,Variant> props,
string service_name)
- throws GLib.Error {
+ throws IOError, DBusError {
music.artist = this.get_string (props, "Artist");
music.album = this.get_string (props, "Album");
music.genre = this.get_string (props, "Genre");
@@ -94,7 +94,7 @@ public class Rygel.External.ItemFactory {
private void set_audio_metadata (AudioItem audio,
HashTable<string,Variant> props,
string service_name)
- throws GLib.Error {
+ throws DBusError {
audio.duration = this.get_int (props, "Duration");
audio.bitrate = this.get_int (props, "Bitrate");
audio.sample_freq = this.get_int (props, "SampleRate");
@@ -105,7 +105,7 @@ public class Rygel.External.ItemFactory {
(VisualItem visual,
HashTable<string,Variant> props,
string service_name)
- throws GLib.Error {
+ throws IOError, DBusError {
visual.width = this.get_int (props, "Width");
visual.height = this.get_int (props, "Height");
visual.color_depth = this.get_int (props, "ColorDepth");
@@ -125,7 +125,7 @@ public class Rygel.External.ItemFactory {
(VideoItem video,
HashTable<string,Variant> props,
string service_name)
- throws GLib.Error {
+ throws IOError, DBusError {
yield this.set_visual_metadata (video, props, service_name);
this.set_audio_metadata (video, props, service_name);
}
diff --git a/src/plugins/external/rygel-external-plugin-factory.vala b/src/plugins/external/rygel-external-plugin-factory.vala
index b56faf8..cceb77d 100644
--- a/src/plugins/external/rygel-external-plugin-factory.vala
+++ b/src/plugins/external/rygel-external-plugin-factory.vala
@@ -31,7 +31,7 @@ private External.PluginFactory plugin_factory;
public void module_init (PluginLoader loader) {
try {
plugin_factory = new External.PluginFactory (loader);
- } catch (IOError error) {
+ } catch (Error error) {
critical ("Failed to fetch list of external services: %s\n",
error.message);
}
@@ -45,7 +45,7 @@ public class Rygel.External.PluginFactory {
PluginLoader loader;
IconFactory icon_factory;
- public PluginFactory (PluginLoader loader) throws IOError {
+ public PluginFactory (PluginLoader loader) throws IOError, DBusError {
this.icon_factory = new IconFactory ();
this.dbus_obj = Bus.get_proxy_sync
@@ -58,7 +58,7 @@ public class Rygel.External.PluginFactory {
this.load_plugins.begin ();
}
- private async void load_plugins () throws IOError {
+ private async void load_plugins () throws DBusError {
var services = yield this.dbus_obj.list_names ();
foreach (var service in services) {
@@ -71,7 +71,7 @@ public class Rygel.External.PluginFactory {
yield this.load_activatable_plugins ();
}
- private async void load_activatable_plugins () throws IOError {
+ private async void load_activatable_plugins () throws DBusError {
var services = yield this.dbus_obj.list_activatable_names ();
foreach (var service in services) {
@@ -108,14 +108,15 @@ public class Rygel.External.PluginFactory {
private async void load_plugin_n_handle_error (string service_name) {
try {
yield this.load_plugin (service_name);
- } catch (IOError error) {
+ } catch (Error error) {
warning ("Failed to load external plugin '%s': %s",
service_name,
error.message);
}
}
- private async void load_plugin (string service_name) throws IOError {
+ private async void load_plugin (string service_name)
+ throws IOError, DBusError {
if (this.loader.plugin_disabled (service_name)) {
message ("Plugin '%s' disabled by user, ignoring..", service_name);
@@ -166,7 +167,7 @@ public class Rygel.External.PluginFactory {
icon);
this.loader.add_plugin (plugin);
- } catch (IOError err) {
+ } catch (Error err) {
critical ("Failed to create root container for '%s': %s. " +
"Ignoring",
service_name,
diff --git a/src/plugins/external/rygel-external-thumbnail-factory.vala b/src/plugins/external/rygel-external-thumbnail-factory.vala
index 8916814..9576da7 100644
--- a/src/plugins/external/rygel-external-thumbnail-factory.vala
+++ b/src/plugins/external/rygel-external-thumbnail-factory.vala
@@ -30,7 +30,7 @@ using FreeDesktop;
public class Rygel.External.ThumbnailFactory {
public async Thumbnail create (string service_name,
string object_path)
- throws GLib.Error {
+ throws IOError, DBusError {
Properties props = yield Bus.get_proxy
(BusType.SESSION,
service_name,
diff --git a/src/plugins/mpris/rygel-mpris-interfaces.vala b/src/plugins/mpris/rygel-mpris-interfaces.vala
index 049fe63..f41d2a8 100644
--- a/src/plugins/mpris/rygel-mpris-interfaces.vala
+++ b/src/plugins/mpris/rygel-mpris-interfaces.vala
@@ -40,10 +40,10 @@ public interface Rygel.MPRIS.MediaPlayer.PlayerProxy : DBusProxy,
public abstract int64 position { get; }
public abstract HashTable<string,Variant> metadata { owned get; }
- public abstract void pause () throws IOError;
- public abstract void play_pause () throws IOError;
- public abstract void stop () throws IOError;
- public abstract void play () throws IOError;
- public abstract void seek (int64 offset) throws IOError;
- public abstract void open_uri (string uri) throws IOError;
+ public abstract void pause () throws DBusError;
+ public abstract void play_pause () throws DBusError;
+ public abstract void stop () throws DBusError;
+ public abstract void play () throws DBusError;
+ public abstract void seek (int64 offset) throws DBusError;
+ public abstract void open_uri (string uri) throws DBusError;
}
diff --git a/src/plugins/mpris/rygel-mpris-plugin-factory.vala b/src/plugins/mpris/rygel-mpris-plugin-factory.vala
index f74db09..2a9ad6c 100644
--- a/src/plugins/mpris/rygel-mpris-plugin-factory.vala
+++ b/src/plugins/mpris/rygel-mpris-plugin-factory.vala
@@ -58,7 +58,7 @@ public class Rygel.MPRIS.PluginFactory {
this.load_plugins.begin ();
}
- private async void load_plugins () throws IOError {
+ private async void load_plugins () throws DBusError {
var services = yield this.dbus_obj.list_names ();
foreach (var service in services) {
@@ -71,7 +71,7 @@ public class Rygel.MPRIS.PluginFactory {
yield this.load_activatable_plugins ();
}
- private async void load_activatable_plugins () throws IOError {
+ private async void load_activatable_plugins () throws DBusError {
var services = yield this.dbus_obj.list_activatable_names ();
foreach (var service in services) {
diff --git a/src/plugins/tracker/rygel-tracker-deletion-query.vala b/src/plugins/tracker/rygel-tracker-deletion-query.vala
index c54e120..b3c2165 100644
--- a/src/plugins/tracker/rygel-tracker-deletion-query.vala
+++ b/src/plugins/tracker/rygel-tracker-deletion-query.vala
@@ -38,7 +38,7 @@ public class Rygel.Tracker.DeletionQuery : Query {
}
public override async void execute (ResourcesIface resources)
- throws IOError {
+ throws IOError, DBusError {
var str = this.to_string ();
debug ("Executing SPARQL query: %s", str);
diff --git a/src/plugins/tracker/rygel-tracker-insertion-query.vala b/src/plugins/tracker/rygel-tracker-insertion-query.vala
index 1fdb2f7..228feb2 100644
--- a/src/plugins/tracker/rygel-tracker-insertion-query.vala
+++ b/src/plugins/tracker/rygel-tracker-insertion-query.vala
@@ -102,7 +102,7 @@ public class Rygel.Tracker.InsertionQuery : Query {
}
public override async void execute (ResourcesIface resources)
- throws IOError {
+ throws IOError, DBusError {
var str = this.to_string ();
debug ("Executing SPARQL query: %s", str);
diff --git a/src/plugins/tracker/rygel-tracker-interfaces.vala b/src/plugins/tracker/rygel-tracker-interfaces.vala
index 9f40722..975ce5d 100644
--- a/src/plugins/tracker/rygel-tracker-interfaces.vala
+++ b/src/plugins/tracker/rygel-tracker-interfaces.vala
@@ -30,19 +30,19 @@ public struct Event {
[DBus (name = "org.freedesktop.Tracker1.Statistics")]
public interface Rygel.Tracker.StatsIface : DBusProxy {
- public abstract string[,] get_statistics () throws IOError;
+ public abstract string[,] get_statistics () throws DBusError;
}
[DBus (name = "org.freedesktop.Tracker1.Resources")]
public interface Rygel.Tracker.ResourcesIface: DBusProxy {
public abstract async string[,] sparql_query (string query)
- throws IOError;
- public abstract async void sparql_update (string query) throws IOError;
+ throws DBusError;
+ public abstract async void sparql_update (string query) throws DBusError;
public abstract async HashTable<string,string>[,] sparql_update_blank
- (string query) throws IOError;
+ (string query) throws DBusError;
}
[DBus (name = "org.freedesktop.Tracker1.Miner.Files.Index")]
public interface Rygel.Tracker.MinerFilesIndexIface: DBusProxy {
- public abstract async void index_file (string uri) throws IOError;
+ public abstract async void index_file (string uri) throws DBusError;
}
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index beb664a..e97140d 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -108,7 +108,7 @@ public abstract class Rygel.Tracker.MetadataValues : Rygel.SimpleContainer {
try {
yield query.execute (this.resources);
- } catch (IOError error) {
+ } catch (Error error) {
critical (_("Error getting all values for '%s': %s"),
string.joinv (" -> ", this.key_chain),
error.message);
diff --git a/src/plugins/tracker/rygel-tracker-plugin-factory.vala b/src/plugins/tracker/rygel-tracker-plugin-factory.vala
index 79b7549..3bc40f3 100644
--- a/src/plugins/tracker/rygel-tracker-plugin-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-plugin-factory.vala
@@ -37,7 +37,7 @@ public void module_init (PluginLoader loader) {
try {
plugin_factory = new Tracker.PluginFactory (loader);
- } catch (IOError err) {
+ } catch (Error err) {
warning (_("Failed to start Tracker service: %s. Plugin disabled.") +
err.message);
}
@@ -51,7 +51,7 @@ public class Rygel.Tracker.PluginFactory {
StatsIface stats;
PluginLoader loader;
- public PluginFactory (PluginLoader loader) throws IOError {
+ public PluginFactory (PluginLoader loader) throws IOError, DBusError {
this.stats = Bus.get_proxy_sync (BusType.SESSION,
TRACKER_SERVICE,
STATISTICS_OBJECT,
diff --git a/src/plugins/tracker/rygel-tracker-query.vala b/src/plugins/tracker/rygel-tracker-query.vala
index 4a66ac4..5499963 100644
--- a/src/plugins/tracker/rygel-tracker-query.vala
+++ b/src/plugins/tracker/rygel-tracker-query.vala
@@ -34,7 +34,7 @@ public abstract class Rygel.Tracker.Query {
}
public abstract async void execute (ResourcesIface resources)
- throws IOError;
+ throws IOError, DBusError;
// Deriving classes should override this method and complete it by
// adding the first part of the query
diff --git a/src/plugins/tracker/rygel-tracker-selection-query.vala b/src/plugins/tracker/rygel-tracker-selection-query.vala
index d538920..a037ada 100644
--- a/src/plugins/tracker/rygel-tracker-selection-query.vala
+++ b/src/plugins/tracker/rygel-tracker-selection-query.vala
@@ -74,7 +74,7 @@ public class Rygel.Tracker.SelectionQuery : Query {
}
public override async void execute (ResourcesIface resources)
- throws IOError {
+ throws IOError, DBusError {
var str = this.to_string ();
debug ("Executing SPARQL query: %s", str);
diff --git a/src/rygel/rygel-dbus-service.vala b/src/rygel/rygel-dbus-service.vala
index 97fca3e..330cd88 100644
--- a/src/rygel/rygel-dbus-service.vala
+++ b/src/rygel/rygel-dbus-service.vala
@@ -28,7 +28,7 @@ public class Rygel.DBusService : Object, DBusInterface {
private Main main;
private uint connection_id;
- public DBusService (Main main) throws IOError {
+ public DBusService (Main main) throws IOError, DBusError {
this.main = main;
DBusObject bus = Bus.get_proxy_sync
diff --git a/src/rygel/rygel-free-desktop-interfaces.vala b/src/rygel/rygel-free-desktop-interfaces.vala
index c17416d..6c2e843 100644
--- a/src/rygel/rygel-free-desktop-interfaces.vala
+++ b/src/rygel/rygel-free-desktop-interfaces.vala
@@ -41,16 +41,16 @@ public interface FreeDesktop.DBusObject: Object {
// FIXME: These methods should be async
public abstract uint32 request_name (string name, uint32 flags)
- throws IOError;
+ throws DBusError;
public abstract uint32 start_service_by_name (string name, uint32 flags)
- throws IOError;
- public abstract async string[] list_names () throws IOError;
- public abstract async string[] list_activatable_names () throws IOError;
+ throws DBusError;
+ public abstract async string[] list_names () throws DBusError;
+ public abstract async string[] list_activatable_names () throws DBusError;
}
[DBus (name = "org.freedesktop.DBus.Properties")]
public interface FreeDesktop.Properties: Object {
public abstract async HashTable<string,Variant> get_all (string iface)
- throws IOError;
+ throws DBusError;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]