[folks] ofono: Throw a useful error if prepare() fails for a missing D-Bus service
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] ofono: Throw a useful error if prepare() fails for a missing D-Bus service
- Date: Wed, 6 Nov 2013 14:36:34 +0000 (UTC)
commit 5248f654d5f74b1565f485769cfc5108f2cacaa9
Author: Philip Withnall <philip withnall collabora co uk>
Date: Mon Nov 4 13:42:41 2013 +0000
ofono: Throw a useful error if prepare() fails for a missing D-Bus service
Previously the error was completely unhelpful.
https://bugzilla.gnome.org/show_bug.cgi?id=711403
backends/ofono/ofono-backend.vala | 26 ++++++++++++++++++--------
po/POTFILES.in | 1 +
po/POTFILES.skip | 1 +
3 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/backends/ofono/ofono-backend.vala b/backends/ofono/ofono-backend.vala
index bd62c5f..1394e21 100644
--- a/backends/ofono/ofono-backend.vala
+++ b/backends/ofono/ofono-backend.vala
@@ -162,7 +162,7 @@ public class Folks.Backends.Ofono.Backend : Folks.Backend
/**
* { inheritDoc}
*/
- public override async void prepare () throws GLib.Error
+ public override async void prepare () throws DBusError
{
Internal.profiling_start ("preparing Ofono.Backend");
@@ -176,13 +176,23 @@ public class Folks.Backends.Ofono.Backend : Folks.Backend
this._prepare_pending = true;
/* New modem devices can be caught in notifications */
- Manager manager = yield Bus.get_proxy (BusType.SYSTEM,
- "org.ofono",
- "/");
- manager.ModemAdded.connect (this._modem_added);
- manager.ModemRemoved.connect (this._modem_removed);
-
- this._modems = manager.GetModems ();
+ Manager manager;
+
+ try
+ {
+ manager = yield Bus.get_proxy (BusType.SYSTEM, "org.ofono", "/");
+ manager.ModemAdded.connect (this._modem_added);
+ manager.ModemRemoved.connect (this._modem_removed);
+
+ this._modems = manager.GetModems ();
+ }
+ catch (GLib.Error e1)
+ {
+ throw new DBusError.SERVICE_UNKNOWN (
+ _("No oFono object manager running, so the oFono " +
+ "backend will be inactive. Either oFono isn’t installed " +
+ "or the service can’t be started."));
+ }
foreach (ModemProperties modem in this._modems)
{
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2cec85a..8d8e71a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,6 +6,7 @@ backends/key-file/kf-backend-factory.vala
backends/key-file/kf-persona-store.vala
backends/key-file/kf-persona.vala
backends/libsocialweb/lib/swf-persona-store.vala
+backends/ofono/ofono-backend.vala
backends/telepathy/lib/tp-lowlevel.c
backends/telepathy/lib/tpf-persona-store.vala
backends/telepathy/lib/tpf-persona.vala
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 9a79619..d7a74b0 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -5,6 +5,7 @@ backends/key-file/kf-backend-factory.c
backends/key-file/kf-persona-store.c
backends/key-file/kf-persona.c
backends/libsocialweb/lib/swf-persona-store.c
+backends/ofono/ofono-backend.c
backends/telepathy/lib/tpf-persona-store.c
backends/telepathy/lib/tpf-persona.c
backends/tracker/lib/trf-persona-store.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]