summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Service.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-01-23 11:31:53 +0100
committerBenoit Foucher <benoit@zeroc.com>2008-01-23 11:31:53 +0100
commitc7fb26230801e62f3e690a8948d37c33517c4c13 (patch)
treef17689f60e13fbbd20d12473272a6f0652f39a78 /cpp/src/Ice/Service.cpp
parentremoving EventHandler in C# (diff)
downloadice-c7fb26230801e62f3e690a8948d37c33517c4c13.tar.bz2
ice-c7fb26230801e62f3e690a8948d37c33517c4c13.tar.xz
ice-c7fb26230801e62f3e690a8948d37c33517c4c13.zip
- 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.
Diffstat (limited to 'cpp/src/Ice/Service.cpp')
-rwxr-xr-xcpp/src/Ice/Service.cpp29
1 files changed, 2 insertions, 27 deletions
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 <IceUtil/DisableWarnings.h>
#include <IceUtil/CtrlCHandler.h>
+#include <IceUtil/StringUtil.h>
#include <IceUtil/Thread.h>
#include <IceUtil/Monitor.h>
#include <IceUtil/Mutex.h>
@@ -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;