[folks] core: Bless DBusError.SERVICE_UNKNOWN for D-Bus service problems on prepare()



commit e49a256f89e49b1a08f04c19336bd0b18f2fe125
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Nov 4 13:41:59 2013 +0000

    core: Bless DBusError.SERVICE_UNKNOWN for D-Bus service problems on prepare()
    
    As folks acquires more D-Bus-enabled backends, we need a common error code
    for when the service can’t be started. In the Backend.prepare() documentation,
    bless DBusError.SERVICE_UNKNOWN as this error code.
    
    Also fix the BlueZ backend to emit it instead of a custom error code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711403

 backends/bluez/bluez-backend.vala |   21 +++------------------
 folks/backend.vala                |    2 ++
 2 files changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/backends/bluez/bluez-backend.vala b/backends/bluez/bluez-backend.vala
index 3f19440..251bf1e 100644
--- a/backends/bluez/bluez-backend.vala
+++ b/backends/bluez/bluez-backend.vala
@@ -35,21 +35,6 @@ using org.bluez;
 extern const string BACKEND_NAME;
 
 /**
- * Errors from the BlueZ { link Backend}.
- *
- * @since UNRELEASED
- */
-public errordomain Folks.Backends.BlueZ.BackendError
-{
-  /**
-   * A required D-Bus service couldn’t be connected to.
-   *
-   * @since UNRELEASED
-   */
-  NO_DBUS_SERVICE
-}
-
-/**
  * A backend which loads { link Persona}s from paired Bluetooth
  * devices using the Phonebook Access Protocol (PBAP) and presents them
  * using one { link PersonaStore} per device.
@@ -447,7 +432,7 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
    *
    * @since UNRELEASED
    */
-  public override async void prepare () throws BackendError
+  public override async void prepare () throws DBusError
     {
       Internal.profiling_start ("preparing BlueZ.Backend");
 
@@ -510,7 +495,7 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
             }
           catch (GLib.Error e1)
             {
-              throw new BackendError.NO_DBUS_SERVICE (
+              throw new DBusError.SERVICE_UNKNOWN (
                   _("No BlueZ 5 object manager running, so the BlueZ " +
                     "backend will be inactive. Either your BlueZ " +
                     "installation is too old (only version 5 is supported) " +
@@ -526,7 +511,7 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
             }
           catch (GLib.Error e1)
             {
-              throw new BackendError.NO_DBUS_SERVICE (
+              throw new DBusError.SERVICE_UNKNOWN (
                   _("Error connecting to OBEX transfer daemon over D-Bus. " +
                     "Ensure BlueZ and obexd are installed."));
             }
diff --git a/folks/backend.vala b/folks/backend.vala
index 96acdc7..71ee630 100644
--- a/folks/backend.vala
+++ b/folks/backend.vala
@@ -179,6 +179,8 @@ public abstract class Folks.Backend : Object
    * @since 0.1.11
    * @throws GLib.Error if preparing the backend-specific services failed — this
    * will be a backend-specific error
+   * @throws DBusError.SERVICE_UNKNOWN if a required D-Bus service was not
+   * installed or could not be started
    */
   public abstract async void prepare () throws GLib.Error;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]