From c7fb26230801e62f3e690a8948d37c33517c4c13 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Wed, 23 Jan 2008 11:31:53 +0100 Subject: - Added IceUtil::SyscallException and cleaned up few IceUtil exceptions - Added errorToString() and lastErrorToString() functions to IceUtil/StringUtil.h - Replaced multiple implementations of errorToString methods with the IceUtil one. - Fixed bug 2641. --- cpp/src/Ice/Service.cpp | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'cpp/src/Ice/Service.cpp') diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp index ed6b2c98a1d..edc357c4620 100755 --- a/cpp/src/Ice/Service.cpp +++ b/cpp/src/Ice/Service.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -1193,33 +1194,7 @@ Ice::Service::initializeCommunicator(int& argc, char* argv[], const Initializati void Ice::Service::syserror(const string& msg) { - string errmsg; -#ifdef _WIN32 - int err = GetLastError(); - if(err < WSABASEERR) - { - LPVOID lpMsgBuf = 0; - DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - 0, - err, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR)&lpMsgBuf, - 0, - 0); - if(ok) - { - LPCTSTR str = (LPCTSTR)lpMsgBuf; - assert(str && strlen((const char*)str) > 0); - errmsg = (const char*)str; - LocalFree(lpMsgBuf); - } - } -#else - int err = errno; - errmsg = strerror(err); -#endif + string errmsg = IceUtilInternal::lastErrorToString(); if(_logger) { ostringstream ostr; -- cgit v1.2.3