Skip to content

Commit

Permalink
Add error message to socket errors (instead of just errno).
Browse files Browse the repository at this point in the history
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 ros-industrial#29.
  • Loading branch information
gavanderhoorn committed Aug 2, 2013
1 parent 2fbeb7f commit 9170601
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion simple_message/include/simple_message/socket/simple_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
}

/**
Expand Down

0 comments on commit 9170601

Please sign in to comment.