diff options
author | Jose <jose@zeroc.com> | 2012-07-13 00:18:06 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2012-07-13 00:18:06 +0200 |
commit | 70802b63320582f0afa8229659ea9fe4a21d02ec (patch) | |
tree | eb455947cc774cc558f96b8d7c78373d2a6f1c2b /cpp/src/Ice/Exception.cpp | |
parent | ICE-4839 - Glacier2 sessionHelper IceSSL plug-in (diff) | |
download | ice-70802b63320582f0afa8229659ea9fe4a21d02ec.tar.bz2 ice-70802b63320582f0afa8229659ea9fe4a21d02ec.tar.xz ice-70802b63320582f0afa8229659ea9fe4a21d02ec.zip |
WinRT support
Diffstat (limited to 'cpp/src/Ice/Exception.cpp')
-rw-r--r-- | cpp/src/Ice/Exception.cpp | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index 04ac02bfad3..7f070b537c5 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -12,12 +12,35 @@ #include <Ice/Network.h> #include <Ice/Plugin.h> #include <IceUtil/StringUtil.h> +#ifdef ICE_OS_WINRT +# include <IceUtil/Unicode.h> +#endif #include <iomanip> using namespace std; using namespace Ice; using namespace IceInternal; +namespace +{ + +inline string +socketErrorToString(int error) +{ + if(error == 0) + { + return "unknown error"; + } +#ifdef ICE_OS_WINRT + return IceUtil::wstringToString( + static_cast<Windows::Networking::Sockets::SocketErrorStatus>(error).ToString()->Data()); +#else + return IceUtilInternal::errorToString(error); +#endif +} + +}; + namespace IceInternal { @@ -283,15 +306,7 @@ void Ice::SocketException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nsocket exception: "; - if(error == 0) - { - out << "unknown error"; - } - else - { - out << IceUtilInternal::errorToString(error); - } + out << ":\nsocket exception: " << socketErrorToString(error); } void @@ -317,14 +332,14 @@ void Ice::ConnectFailedException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nconnect failed: " << IceUtilInternal::errorToString(error); + out << ":\nconnect failed: " << socketErrorToString(error); } void Ice::ConnectionRefusedException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nconnection refused: " << IceUtilInternal::errorToString(error); + out << ":\nconnection refused: " << socketErrorToString(error); } void @@ -338,7 +353,7 @@ Ice::ConnectionLostException::ice_print(ostream& out) const } else { - out << IceUtilInternal::errorToString(error); + out << socketErrorToString(error); } } @@ -346,7 +361,13 @@ void Ice::DNSException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nDNS error: " << errorToStringDNS(error) << "\nhost: " << host; + out << ":\nDNS error: "; +#ifdef ICE_OS_WINRT + out << socketErrorToString(error); +#else + out << errorToStringDNS(error); +#endif + out << "\nhost: " << host; } void |