diff options
author | Michi Henning <michi@zeroc.com> | 2003-03-05 04:44:06 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2003-03-05 04:44:06 +0000 |
commit | cbf6716868fd679530dc38be5b956ede9fbea612 (patch) | |
tree | beaed87efc62a11ecdaae0778923176d6c00e31b /cpp/src/Ice/Exception.cpp | |
parent | use depend tag (diff) | |
download | ice-cbf6716868fd679530dc38be5b956ede9fbea612.tar.bz2 ice-cbf6716868fd679530dc38be5b956ede9fbea612.tar.xz ice-cbf6716868fd679530dc38be5b956ede9fbea612.zip |
Merged in changes for protocol versioning.
Diffstat (limited to 'cpp/src/Ice/Exception.cpp')
-rw-r--r-- | cpp/src/Ice/Exception.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index 0a5c1ca19be..2495a24137e 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -19,6 +19,7 @@ #include <Ice/IdentityUtil.h> #include <Ice/StringUtil.h> #include <Ice/Plugin.h> +#include <iomanip> using namespace std; using namespace Ice; @@ -257,17 +258,40 @@ Ice::ProtocolException::ice_print(ostream& out) const } void +Ice::BadMagicException::ice_print(ostream& out) const +{ + Exception::ice_print(out); + out << ":\nunknown magic number: "; + + ios_base::fmtflags originalFlags = out.flags(); // Save stream state + ostream::char_type originalFill = out.fill(); + + out.flags(ios_base::hex); // Change to hex + out.fill('0'); // Fill with leading zeros + + out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[0])) << ", "; + out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[1])) << ", "; + out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[2])) << ", "; + out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[3])); + + out.fill(originalFill); // Restore stream state + out.flags(originalFlags); +} + +void Ice::UnsupportedProtocolException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nprotocol error: unsupported protocol version"; + out << ":\nprotocol error: unsupported protocol version: " << badMajor << "." << badMinor; + out << "\n(can only support protocols compatible with version " << major << "." << minor << ")"; } void Ice::UnsupportedEncodingException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nprotocol error: unsupported encoding version"; + out << ":\nprotocol error: unsupported encoding version: " << badMajor << "." << badMinor; + out << "\n(can only support encodings compatible with version " << major << "." << major << ")"; } void |