OSDN Git Service

client/transfer: Add proper message to errors
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 8 Aug 2013 13:41:14 +0000 (16:41 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 12 Aug 2013 10:48:09 +0000 (13:48 +0300)
This improve the error message when a transfer fails by using
g_obex_strerror to decode the response code to a human readable string.

obexd/client/transfer.c

index 4b1def3..2e8f7c7 100644 (file)
@@ -596,8 +596,8 @@ static void get_xfer_progress_first(GObex *obex, GError *err, GObexPacket *rsp,
 
        rspcode = g_obex_packet_get_operation(rsp, &final);
        if (rspcode != G_OBEX_RSP_SUCCESS && rspcode != G_OBEX_RSP_CONTINUE) {
-               err = g_error_new(OBC_TRANSFER_ERROR, rspcode,
-                                       "Transfer failed (0x%02x)", rspcode);
+               err = g_error_new(OBC_TRANSFER_ERROR, rspcode, "%s",
+                                               g_obex_strerror(rspcode));
                xfer_complete(obex, err, transfer);
                g_error_free(err);
                return;