From 8485e0b94b49d7b0f1c7aec85a3bd7d071240012 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 19 Aug 2014 13:48:41 +0200 Subject: [PATCH] Reword error messages a bit refs #6070 --- lib/base/socket.cpp | 32 ++++++++++++++++---------------- lib/base/tcpsocket.cpp | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/base/socket.cpp b/lib/base/socket.cpp index 452f1adab..3156ac52e 100644 --- a/lib/base/socket.cpp +++ b/lib/base/socket.cpp @@ -132,7 +132,7 @@ String Socket::GetAddressFromSockaddr(sockaddr *address, socklen_t len) sizeof(service), NI_NUMERICHOST | NI_NUMERICSERV) < 0) { #ifndef _WIN32 std::ostringstream msgbuf; - msgbuf << "getnameinfo() failed with return code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; + msgbuf << "getnameinfo() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -140,7 +140,7 @@ String Socket::GetAddressFromSockaddr(sockaddr *address, socklen_t len) << boost::errinfo_errno(errno)); #else /* _WIN32 */ std::ostringstream msgbuf; - msgbuf << "getnameinfo() failed with return code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; + msgbuf << "getnameinfo() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -169,7 +169,7 @@ String Socket::GetClientAddress(void) if (getsockname(GetFD(), (sockaddr *)&sin, &len) < 0) { #ifndef _WIN32 std::ostringstream msgbuf; - msgbuf << "getsockname() failed with return code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; + msgbuf << "getsockname() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -177,7 +177,7 @@ String Socket::GetClientAddress(void) << boost::errinfo_errno(errno)); #else /* _WIN32 */ std::ostringstream msgbuf; - msgbuf << "getsockname() failed with return code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; + msgbuf << "getsockname() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -211,7 +211,7 @@ String Socket::GetPeerAddress(void) if (getpeername(GetFD(), (sockaddr *)&sin, &len) < 0) { #ifndef _WIN32 std::ostringstream msgbuf; - msgbuf << "getpeername() failed with return code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; + msgbuf << "getpeername() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -219,7 +219,7 @@ String Socket::GetPeerAddress(void) << boost::errinfo_errno(errno)); #else /* _WIN32 */ std::ostringstream msgbuf; - msgbuf << "getpeername() failed with return code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; + msgbuf << "getpeername() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -246,7 +246,7 @@ void Socket::Listen(void) if (listen(GetFD(), SOMAXCONN) < 0) { #ifndef _WIN32 std::ostringstream msgbuf; - msgbuf << "listen() failed with return code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; + msgbuf << "listen() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -254,7 +254,7 @@ void Socket::Listen(void) << boost::errinfo_errno(errno)); #else /* _WIN32 */ std::ostringstream msgbuf; - msgbuf << "listen() failed with return code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; + msgbuf << "listen() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -274,7 +274,7 @@ size_t Socket::Write(const void *buffer, size_t count) if (rc < 0) { #ifndef _WIN32 std::ostringstream msgbuf; - msgbuf << "send() failed with return code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; + msgbuf << "send() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -282,7 +282,7 @@ size_t Socket::Write(const void *buffer, size_t count) << boost::errinfo_errno(errno)); #else /* _WIN32 */ std::ostringstream msgbuf; - msgbuf << "send() failed with return code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; + msgbuf << "send() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -304,7 +304,7 @@ size_t Socket::Read(void *buffer, size_t count) if (rc < 0) { #ifndef _WIN32 std::ostringstream msgbuf; - msgbuf << "recv() failed with return code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; + msgbuf << "recv() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -312,7 +312,7 @@ size_t Socket::Read(void *buffer, size_t count) << boost::errinfo_errno(errno)); #else /* _WIN32 */ std::ostringstream msgbuf; - msgbuf << "recv() failed with return code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; + msgbuf << "recv() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -338,7 +338,7 @@ Socket::Ptr Socket::Accept(void) if (fd < 0) { #ifndef _WIN32 std::ostringstream msgbuf; - msgbuf << "accept() failed with return code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; + msgbuf << "accept() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -346,7 +346,7 @@ Socket::Ptr Socket::Accept(void) << boost::errinfo_errno(errno)); #else /* _WIN32 */ std::ostringstream msgbuf; - msgbuf << "accept() failed with return code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; + msgbuf << "accept() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -380,7 +380,7 @@ bool Socket::Poll(bool read, bool write) if (rc < 0) { std::ostringstream msgbuf; - msgbuf << "select() failed with return code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; + msgbuf << "select() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -397,7 +397,7 @@ bool Socket::Poll(bool read, bool write) if (rc < 0) { std::ostringstream msgbuf; - msgbuf << "poll() failed with return code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; + msgbuf << "poll() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\""; Log(LogCritical, "Socket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() diff --git a/lib/base/tcpsocket.cpp b/lib/base/tcpsocket.cpp index 2f7ab1fb6..46fd1df28 100644 --- a/lib/base/tcpsocket.cpp +++ b/lib/base/tcpsocket.cpp @@ -63,7 +63,7 @@ void TcpSocket::Bind(const String& node, const String& service, int family) if (rc != 0) { std::ostringstream msgbuf; - msgbuf << "getaddrinfo() failed with return code " << rc << ", \"" << gai_strerror(rc) << "\""; + msgbuf << "getaddrinfo() failed with error code " << rc << ", \"" << gai_strerror(rc) << "\""; Log(LogCritical, "TcpSocket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error() @@ -156,7 +156,7 @@ void TcpSocket::Connect(const String& node, const String& service) if (rc != 0) { std::ostringstream msgbuf; - msgbuf << "getaddrinfo() failed with return code " << rc << ", \"" << gai_strerror(rc) << "\""; + msgbuf << "getaddrinfo() failed with error code " << rc << ", \"" << gai_strerror(rc) << "\""; Log(LogCritical, "TcpSocket", msgbuf.str()); BOOST_THROW_EXCEPTION(socket_error()