diff options
Diffstat (limited to 'cpp/src/Ice/Exception.cpp')
-rw-r--r-- | cpp/src/Ice/Exception.cpp | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index 7f070b537c5..724a306017f 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -11,6 +11,7 @@ #include <Ice/LocalException.h> #include <Ice/Network.h> #include <Ice/Plugin.h> +#include <Ice/SlicedData.h> #include <IceUtil/StringUtil.h> #ifdef ICE_OS_WINRT # include <IceUtil/Unicode.h> @@ -48,11 +49,23 @@ namespace Ex { void -throwUOE(const string& expectedType, const string& actualType) +throwUOE(const string& expectedType, const ObjectPtr& v) { + // + // If the object is an unknown sliced object, we didn't find an + // object factory, in this case raise a NoObjectFactoryException + // instead. + // + UnknownSlicedObject* uso = dynamic_cast<UnknownSlicedObject*>(v.get()); + if(uso) + { + throw NoObjectFactoryException(__FILE__, __LINE__, "", uso->getUnknownTypeId()); + } + + string type = v->ice_id(); throw Ice::UnexpectedObjectException(__FILE__, __LINE__, - "expected element of type `" + expectedType + "' but received '" + actualType, - actualType, expectedType); + "expected element of type `" + expectedType + "' but received '" + + type, type, expectedType); } void @@ -79,6 +92,11 @@ Ice::UserException::__usesClasses() const return false; } +void +Ice::UserException::__usesClasses(bool) +{ +} + Ice::LocalException::LocalException(const char* file, int line) : Exception(file, line) { @@ -214,6 +232,13 @@ Ice::EndpointSelectionTypeParseException::ice_print(ostream& out) const } void +Ice::VersionParseException::ice_print(ostream& out) const +{ + Exception::ice_print(out); + out << ":\nerror while parsing version `" << str << "'"; +} + +void Ice::IdentityParseException::ice_print(ostream& out) const { Exception::ice_print(out); @@ -439,16 +464,16 @@ void Ice::UnsupportedProtocolException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nprotocol error: unsupported protocol version: " << badMajor << "." << badMinor; - out << "\n(can only support protocols compatible with version " << major << "." << minor << ")"; + out << ":\nprotocol error: unsupported protocol version: " << bad; + out << "\n(can only support protocols compatible with version " << supported << ")"; } void Ice::UnsupportedEncodingException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nprotocol error: unsupported encoding version: " << badMajor << "." << badMinor; - out << "\n(can only support encodings compatible with version " << major << "." << major << ")"; + out << ":\nprotocol error: unsupported encoding version: " << bad; + out << "\n(can only support encodings compatible with version " << supported << ")"; if(!reason.empty()) { out << "\n" << reason; |