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/IceUtil/ThreadException.cpp | 46 +------------------------------------ 1 file changed, 1 insertion(+), 45 deletions(-) (limited to 'cpp/src/IceUtil/ThreadException.cpp') diff --git a/cpp/src/IceUtil/ThreadException.cpp b/cpp/src/IceUtil/ThreadException.cpp index 7a17a98185e..c24eae6754c 100644 --- a/cpp/src/IceUtil/ThreadException.cpp +++ b/cpp/src/IceUtil/ThreadException.cpp @@ -12,8 +12,7 @@ using namespace std; IceUtil::ThreadSyscallException::ThreadSyscallException(const char* file, int line, int err ): - Exception(file, line), - _error(err) + SyscallException(file, line, err) { } @@ -25,42 +24,6 @@ IceUtil::ThreadSyscallException::ice_name() const return _name; } -void -IceUtil::ThreadSyscallException::ice_print(ostream& os) const -{ - Exception::ice_print(os); - if(_error != 0) - { - os << ":\nthread syscall exception: "; -#ifdef _WIN32 - LPVOID lpMsgBuf = 0; - DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - _error, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR)&lpMsgBuf, - 0, - NULL); - - if(ok) - { - LPCTSTR msg = (LPCTSTR)lpMsgBuf; - assert(msg && strlen((char*)msg) > 0); - os << msg; - LocalFree(lpMsgBuf); - } - else - { - os << "unknown thread error"; - } -#else - os << strerror(_error); -#endif - } -} - IceUtil::Exception* IceUtil::ThreadSyscallException::ice_clone() const { @@ -73,13 +36,6 @@ IceUtil::ThreadSyscallException::ice_throw() const throw *this; } -int -IceUtil::ThreadSyscallException::error() const -{ - return _error; -} - - IceUtil::ThreadLockedException::ThreadLockedException(const char* file, int line) : Exception(file, line) { -- cgit v1.2.3