OSDN Git Service

neard: Adjust errors to latest API changes
authorSzymon Janc <szymon.janc@tieto.com>
Thu, 7 Feb 2013 08:13:51 +0000 (09:13 +0100)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 15 Feb 2013 08:36:17 +0000 (10:36 +0200)
neard Handover API was stripped of not really usefull error codes.

plugins/neard.c

index b0150e9..6272144 100644 (file)
@@ -57,27 +57,14 @@ static gboolean agent_register_postpone = FALSE;
 
 static DBusMessage *error_reply(DBusMessage *msg, int error)
 {
-       switch (error) {
-       case ENOTSUP:
-               return g_dbus_create_error(msg, ERROR_INTERFACE ".NotSupported",
-                                               "Operation is not supported");
+       const char *name;
 
-       case ENOENT:
-               return g_dbus_create_error(msg, ERROR_INTERFACE ".NoSuchDevice",
-                                                       "No such device");
-
-       case EINPROGRESS:
-               return g_dbus_create_error(msg, ERROR_INTERFACE ".InProgress",
-                                               "Operation already in progress");
-
-       case ENONET:
-               return g_dbus_create_error(msg, ERROR_INTERFACE ".Disabled",
-                                                       "Device disabled");
+       if (error == EINPROGRESS)
+               name = ERROR_INTERFACE ".InProgress";
+       else
+               name = ERROR_INTERFACE ".Failed";
 
-       default:
-               return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
-                                                       "%s", strerror(error));
-       }
+       return g_dbus_create_error(msg, name , "%s", strerror(error));
 }
 
 static void register_agent_cb(DBusPendingCall *call, void *user_data)