summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2011-02-17 19:00:47 -0300
committerMarcel Holtmann <marcel@holtmann.org>2011-02-17 16:02:03 -0800
commitdf3d0d8365ba22f3a177b367d595df82a9349ba9 (patch)
tree3d2b5bdf16fe65471a26d251c9a4f7ceceff2d8d
parenta0dce4c015bdba3324cd6d24085cd4ab52d33a66 (diff)
downloadofono-df3d0d8365ba22f3a177b367d595df82a9349ba9.tar.bz2
bluetooth: change how we report DBus errors
-rw-r--r--plugins/bluetooth.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 8ca9f5f4..161ae4ba 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -267,19 +267,16 @@ static void device_properties_cb(DBusPendingCall *call, gpointer user_data)
const char *device_addr = NULL;
const char *alias = NULL;
struct bluetooth_profile *profile;
+ struct DBusError derr;
reply = dbus_pending_call_steal_reply(call);
- if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN)) {
- DBG("Bluetooth daemon is apparently not available.");
- goto done;
- }
-
- if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
- if (!dbus_message_is_error(reply, DBUS_ERROR_UNKNOWN_METHOD))
- ofono_info("Error from GetProperties reply: %s",
- dbus_message_get_error_name(reply));
+ dbus_error_init(&derr);
+ if (dbus_set_error_from_message(&derr, reply)) {
+ ofono_error("Device.GetProperties replied an error: %s, %s",
+ derr.name, derr.message);
+ dbus_error_free(&derr);
goto done;
}
@@ -397,14 +394,19 @@ static void adapter_properties_cb(DBusPendingCall *call, gpointer user_data)
{
const char *path = user_data;
DBusMessage *reply;
+ DBusError derr;
GSList *device_list = NULL;
GSList *l;
const char *addr;
reply = dbus_pending_call_steal_reply(call);
- if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN)) {
- DBG("Bluetooth daemon is apparently not available.");
+ dbus_error_init(&derr);
+
+ if (dbus_set_error_from_message(&derr, reply)) {
+ ofono_error("Adapter.GetProperties replied an error: %s, %s",
+ derr.name, derr.message);
+ dbus_error_free(&derr);
goto done;
}
@@ -717,11 +719,16 @@ static void parse_adapters(DBusMessageIter *array, gpointer user_data)
static void manager_properties_cb(DBusPendingCall *call, gpointer user_data)
{
DBusMessage *reply;
+ DBusError derr;
reply = dbus_pending_call_steal_reply(call);
- if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN)) {
- DBG("Bluetooth daemon is apparently not available.");
+ dbus_error_init(&derr);
+
+ if (dbus_set_error_from_message(&derr, reply)) {
+ ofono_error("Manager.GetProperties() replied an error: %s, %s",
+ derr.name, derr.message);
+ dbus_error_free(&derr);
goto done;
}