From 9170601d7f2d8b2ffa0ce8df6d4a29873c195e08 Mon Sep 17 00:00:00 2001 From: gavanderhoorn Date: Fri, 2 Aug 2013 11:27:13 +0200 Subject: [PATCH] Add error message to socket errors (instead of just errno). Changes `socketError(..)` output from: > Failed to connect to server, rc: -1, errno: 113 to: > Failed to connect to server, rc: -1. Error: 'No route to host' (errno: 113) which should give some more information to the user. Fix #29. --- simple_message/include/simple_message/socket/simple_socket.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simple_message/include/simple_message/socket/simple_socket.h b/simple_message/include/simple_message/socket/simple_socket.h index 61df3f59..83fbf79d 100644 --- a/simple_message/include/simple_message/socket/simple_socket.h +++ b/simple_message/include/simple_message/socket/simple_socket.h @@ -203,7 +203,8 @@ class SimpleSocket : public industrial::smpl_msg_connection::SmplMsgConnection void logSocketError(const char* msg, int rc) { - LOG_ERROR("%s, rc: %d, errno: %d", msg, rc, errno); + int errno_ = errno; + LOG_ERROR("%s, rc: %d. Error: '%s' (errno: %d)", msg, rc, strerror(errno_), errno_); } /**