diff options
author | Marc Laukien <marc@zeroc.com> | 2001-10-11 18:09:45 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-10-11 18:09:45 +0000 |
commit | d97f276ddf939534613d7c0c6067205e7effc133 (patch) | |
tree | aaef4b3e8007dbd53b050329ec91d8c73558aaa8 /cpp/src | |
parent | more exception stuff (diff) | |
download | ice-d97f276ddf939534613d7c0c6067205e7effc133.tar.bz2 ice-d97f276ddf939534613d7c0c6067205e7effc133.tar.xz ice-d97f276ddf939534613d7c0c6067205e7effc133.zip |
more exception cleanup
Diffstat (limited to 'cpp/src')
30 files changed, 478 insertions, 181 deletions
diff --git a/cpp/src/Ice/.depend b/cpp/src/Ice/.depend index b19412dc815..3b3c3210631 100644 --- a/cpp/src/Ice/.depend +++ b/cpp/src/Ice/.depend @@ -1,4 +1,5 @@ Application.o: Application.cpp ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/LocalObjectF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ServantFactoryF.h ../../include/Ice/StreamF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/Stream.h ../../include/Ice/ServantFactory.h ../../include/Ice/Initialize.h ../../include/Ice/InstanceF.h +Exception.o: Exception.cpp ../../include/Ice/Exception.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/LocalException.h ../../include/Ice/Config.h ../Ice/Network.h LocalException.o: LocalException.cpp ../../include/Ice/LocalException.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../Ice/Network.h Properties.o: Properties.cpp ../../include/Ice/Properties.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/LocalObjectF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h PropertiesI.o: PropertiesI.cpp ../Ice/PropertiesI.h ../../include/Ice/Properties.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/LocalObjectF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/LocalException.h diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index 25e0805425b..a2cb118e5df 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -15,7 +15,7 @@ #include <Ice/ProxyFactory.h> #include <Ice/ServantFactory.h> #include <Ice/ServantFactoryManager.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/Collector.cpp b/cpp/src/Ice/Collector.cpp index 63c25b1e14d..12539267109 100644 --- a/cpp/src/Ice/Collector.cpp +++ b/cpp/src/Ice/Collector.cpp @@ -18,7 +18,7 @@ #include <Ice/ObjectAdapter.h> #include <Ice/Endpoint.h> #include <Ice/Incoming.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> #include <Ice/Protocol.h> #include <Ice/Functional.h> diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 38f42823175..78a149ba5c1 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -18,7 +18,7 @@ #include <Ice/Logger.h> #include <Ice/StreamI.h> #include <Ice/Initialize.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/Direct.cpp b/cpp/src/Ice/Direct.cpp index d1efbf2cb69..539b2801773 100644 --- a/cpp/src/Ice/Direct.cpp +++ b/cpp/src/Ice/Direct.cpp @@ -12,7 +12,7 @@ #include <Ice/ObjectAdapter.h> #include <Ice/Reference.h> #include <Ice/Object.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/Emitter.cpp b/cpp/src/Ice/Emitter.cpp index a05da9429b6..5b4eec32b4f 100644 --- a/cpp/src/Ice/Emitter.cpp +++ b/cpp/src/Ice/Emitter.cpp @@ -18,7 +18,7 @@ #include <Ice/ThreadPool.h> #include <Ice/Endpoint.h> #include <Ice/Outgoing.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> #include <Ice/Protocol.h> #include <Ice/Functional.h> diff --git a/cpp/src/Ice/Endpoint.cpp b/cpp/src/Ice/Endpoint.cpp index f6bf95f159c..8fc2718a3d0 100644 --- a/cpp/src/Ice/Endpoint.cpp +++ b/cpp/src/Ice/Endpoint.cpp @@ -18,7 +18,7 @@ #include <Ice/SslTransceiver.h> #include <Ice/UdpTransceiver.h> #include <Ice/BasicStream.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp new file mode 100644 index 00000000000..9c1a46cc99e --- /dev/null +++ b/cpp/src/Ice/Exception.cpp @@ -0,0 +1,337 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Exception.h> +#include <Ice/Network.h> + +using namespace std; +using namespace Ice; +using namespace IceInternal; + +Ice::LocalException::LocalException(const char* file, int line) : + Exception(file, line) +{ +} + +Ice::LocalException::LocalException(const LocalException& ex) : + Exception(ex) +{ +} + +LocalException& +Ice::LocalException::operator=(const LocalException& ex) +{ + Exception::operator=(ex); + return *this; +} + +string +Ice::LocalException::_name() const +{ + return "Ice::LocalException"; +} + +ostream& +Ice::LocalException::_print(ostream& out) const +{ + return IceUtil::printException(out, *this); +} + +LocalException* +Ice::LocalException::_clone() const +{ + return new LocalException(*this); +} + +void +Ice::LocalException::_throw() const +{ + throw *this; +} + +Ice::UserException::UserException(const char* file, int line) : + Exception(file, line) +{ +} + +Ice::UserException::UserException(const UserException& ex) : + Exception(ex) +{ +} + +UserException& +Ice::UserException::operator=(const UserException& ex) +{ + Exception::operator=(ex); + return *this; +} + +string +Ice::UserException::_name() const +{ + return "Ice::UserException"; +} + +ostream& +Ice::UserException::_print(ostream& out) const +{ + return IceUtil::printException(out, *this); +} + +UserException* +Ice::UserException::_clone() const +{ + return new UserException(*this); +} + +void +Ice::UserException::_throw() const +{ + throw *this; +} + +ostream& +IceUtil::printException(ostream& out, const LocalException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": unknown local exception"; +} + +ostream& +IceUtil::printException(ostream& out, const UserException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": unknown user exception"; +} + +ostream& +IceUtil::printException(ostream& out, const UnknownException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": unknown C++ exception"; +} + +ostream& +IceUtil::printException(ostream& out, const VersionMismatchException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": Ice library version mismatch"; +} + +ostream& +IceUtil::printException(ostream& out, const CommunicatorDestroyedException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": communicator object destroyed"; +} + +ostream& +IceUtil::printException(ostream& out, const ObjectAdapterDeactivatedException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": object adapter deactivated"; +} + +ostream& +IceUtil::printException(ostream& out, const NoEndpointException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": no suitable endpoint available"; +} + +ostream& +IceUtil::printException(ostream& out, const EndpointParseException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": error while parsing endpoint"; +} + +ostream& +IceUtil::printException(ostream& out, const ReferenceParseException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": error while parsing reference"; +} + +ostream& +IceUtil::printException(ostream& out, const ReferenceIdentityException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": reference identity mismatch in location forward"; +} + +ostream& +IceUtil::printException(ostream& out, const ObjectNotExistException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": object does not exist"; +} + +ostream& +IceUtil::printException(ostream& out, const OperationNotExistException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": operation does not exist"; +} + +ostream& +IceUtil::printException(ostream& out, const NoServantFactoryException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": no servant factory found for the requested servant type"; +} + +ostream& +IceUtil::printException(ostream& out, const SystemException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": system exception: " << errorToString(ex.error); +} + +ostream& +IceUtil::printException(ostream& out, const SocketException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": system exception: " << errorToString(ex.error); +} + +ostream& +IceUtil::printException(ostream& out, const TimeoutException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": timeout while sending or receiving data"; +} + +ostream& +IceUtil::printException(ostream& out, const ConnectTimeoutException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": timeout while establishing a connection"; +} + +ostream& +IceUtil::printException(ostream& out, const ConnectFailedException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": connect failed: " << errorToString(ex.error); +} + +ostream& +IceUtil::printException(ostream& out, const ConnectionLostException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + out << ": connection lost: "; + if (ex.error == 0) + { + return out << "recv() returned zero"; + } + else + { + return out << errorToString(ex.error); + } +} + +ostream& +IceUtil::printException(ostream& out, const DNSException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": DNS error: " + errorToStringDNS(ex.error); +} + +ostream& +IceUtil::printException(ostream& out, const UnmarshalOutOfBoundsException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: out of bounds during unmarshaling"; +} + +ostream& +IceUtil::printException(ostream& out, const ServantUnmarshalException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: servant type does not match signature"; +} + +ostream& +IceUtil::printException(ostream& out, const StringEncodingException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: string encoding error"; +} + +ostream& +IceUtil::printException(ostream& out, const MemoryLimitException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: memory limit exceeded"; +} + +ostream& +IceUtil::printException(ostream& out, const EncapsulationException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: illegal encapsulation"; +} + +ostream& +IceUtil::printException(ostream& out, const UnsupportedProtocolException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: unsupported protocol version"; +} + +ostream& +IceUtil::printException(ostream& out, const UnsupportedEncodingException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: unsupported encoding version"; +} + +ostream& +IceUtil::printException(ostream& out, const InvalidMessageException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: invalid message type"; +} + +ostream& +IceUtil::printException(ostream& out, const UnknownMessageException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: unknown message type"; +} + +ostream& +IceUtil::printException(ostream& out, const UnknownRequestIdException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: unknown request id"; +} + +ostream& +IceUtil::printException(ostream& out, const UnknownReplyStatusException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: unknown reply status"; +} + +ostream& +IceUtil::printException(ostream& out, const CloseConnectionException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: connection closed by server"; +} + +ostream& +IceUtil::printException(ostream& out, const AbortBatchRequestException& ex) +{ + IceUtil::printException(out, static_cast<const IceUtil::Exception&>(ex)); + return out << ": protocol error: batch request was aborted"; +} diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 1a4addb5b93..f9b625ccddc 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -11,7 +11,7 @@ #include <Ice/Incoming.h> #include <Ice/ObjectAdapter.h> #include <Ice/Object.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 0b8a47cf1fe..eef644ab73b 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -15,7 +15,7 @@ #include <Ice/Emitter.h> #include <Ice/ServantFactoryManager.h> #include <Ice/ObjectAdapterFactory.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> #include <Ice/Properties.h> #include <Ice/LoggerI.h> diff --git a/cpp/src/Ice/LocalException.cpp b/cpp/src/Ice/LocalException.cpp index e14a36df156..c0f65123f93 100644 --- a/cpp/src/Ice/LocalException.cpp +++ b/cpp/src/Ice/LocalException.cpp @@ -8,7 +8,7 @@ // // ********************************************************************** -#include <Ice/LocalException.h> +#include <Ice/Exception.h> #include <Ice/Network.h> using namespace std; @@ -38,10 +38,10 @@ Ice::UnknownException::_name() const return "Ice::UnknownException"; } -string -Ice::UnknownException::_description() const +ostream& +Ice::UnknownException::_print(ostream& out) const { - return "unknown exception"; + return IceUtil::printException(out, *this); } LocalException* @@ -56,47 +56,6 @@ Ice::UnknownException::_throw() const throw *this; } -Ice::UnknownUserException::UnknownUserException(const char* file, int line) : - LocalException(file, line) -{ -} - -Ice::UnknownUserException::UnknownUserException(const UnknownUserException& ex) : - LocalException(ex) -{ -} - -UnknownUserException& -Ice::UnknownUserException::operator=(const UnknownUserException& ex) -{ - LocalException::operator=(ex); - return *this; -} - -string -Ice::UnknownUserException::_name() const -{ - return "Ice::UnknownUserException"; -} - -string -Ice::UnknownUserException::_description() const -{ - return "unknown user exception"; -} - -LocalException* -Ice::UnknownUserException::_clone() const -{ - return new UnknownUserException(*this); -} - -void -Ice::UnknownUserException::_throw() const -{ - throw *this; -} - Ice::VersionMismatchException::VersionMismatchException(const char* file, int line) : LocalException(file, line) { @@ -120,10 +79,10 @@ Ice::VersionMismatchException::_name() const return "Ice::VersionMismatchException"; } -string -Ice::VersionMismatchException::_description() const +ostream& +Ice::VersionMismatchException::_print(ostream& out) const { - return "Ice library version mismatch"; + return IceUtil::printException(out, *this); } LocalException* @@ -161,10 +120,10 @@ Ice::CommunicatorDestroyedException::_name() const return "Ice::CommunicatorDestroyedException"; } -string -Ice::CommunicatorDestroyedException::_description() const +ostream& +Ice::CommunicatorDestroyedException::_print(ostream& out) const { - return "communicator object destroyed"; + return IceUtil::printException(out, *this); } LocalException* @@ -202,10 +161,10 @@ Ice::ObjectAdapterDeactivatedException::_name() const return "Ice::ObjectAdapterDeactivatedException"; } -string -Ice::ObjectAdapterDeactivatedException::_description() const +ostream& +Ice::ObjectAdapterDeactivatedException::_print(ostream& out) const { - return "object adapter deactivated"; + return IceUtil::printException(out, *this); } LocalException* @@ -243,10 +202,10 @@ Ice::NoEndpointException::_name() const return "Ice::NoEndpointException"; } -string -Ice::NoEndpointException::_description() const +ostream& +Ice::NoEndpointException::_print(ostream& out) const { - return "no suitable endpoint available"; + return IceUtil::printException(out, *this); } LocalException* @@ -284,10 +243,10 @@ Ice::EndpointParseException::_name() const return "Ice::EndpointParseException"; } -string -Ice::EndpointParseException::_description() const +ostream& +Ice::EndpointParseException::_print(ostream& out) const { - return "error while parsing endpoint"; + return IceUtil::printException(out, *this); } LocalException* @@ -325,10 +284,10 @@ Ice::ReferenceParseException::_name() const return "Ice::ReferenceParseException"; } -string -Ice::ReferenceParseException::_description() const +ostream& +Ice::ReferenceParseException::_print(ostream& out) const { - return "error while parsing reference"; + return IceUtil::printException(out, *this); } LocalException* @@ -366,10 +325,10 @@ Ice::ReferenceIdentityException::_name() const return "Ice::ReferenceIdentityException"; } -string -Ice::ReferenceIdentityException::_description() const +ostream& +Ice::ReferenceIdentityException::_print(ostream& out) const { - return "reference identity mismatch in location forward"; + return IceUtil::printException(out, *this); } LocalException* @@ -407,10 +366,10 @@ Ice::ObjectNotExistException::_name() const return "Ice::ObjectNotExistException"; } -string -Ice::ObjectNotExistException::_description() const +ostream& +Ice::ObjectNotExistException::_print(ostream& out) const { - return "object does not exist"; + return IceUtil::printException(out, *this); } LocalException* @@ -448,10 +407,10 @@ Ice::OperationNotExistException::_name() const return "Ice::OperationNotExistException"; } -string -Ice::OperationNotExistException::_description() const +ostream& +Ice::OperationNotExistException::_print(ostream& out) const { - return "operation does not exist"; + return IceUtil::printException(out, *this); } LocalException* @@ -489,10 +448,10 @@ Ice::NoServantFactoryException::_name() const return "Ice::NoServantFactoryException"; } -string -Ice::NoServantFactoryException::_description() const +ostream& +Ice::NoServantFactoryException::_print(ostream& out) const { - return "no servant factory found for the requested servant type"; + return IceUtil::printException(out, *this); } LocalException* @@ -511,16 +470,16 @@ Ice::SystemException::SystemException(const char* file, int line) : LocalException(file, line) { #ifdef WIN32 - _error = GetLastError(); + error = GetLastError(); #else - _error = errno; + error = errno; #endif } Ice::SystemException::SystemException(const SystemException& ex) : LocalException(ex) { - _error = ex._error; + error = ex.error; } SystemException& @@ -530,7 +489,7 @@ Ice::SystemException::operator=(const SystemException& ex) if (this != &ex) { - _error = ex._error; + error = ex.error; } return *this; @@ -541,12 +500,12 @@ Ice::SystemException::_name() const { return "Ice::SystemException"; } -string -Ice::SystemException::_description() const + +ostream& +Ice::SystemException::_print(ostream& out) const { - return "system exception: " + errorToString(_error); + return IceUtil::printException(out, *this); } - LocalException* Ice::SystemException::_clone() const { @@ -564,10 +523,10 @@ Ice::SocketException::SocketException(const char* file, int line) : { #ifdef WIN32 // - // Overwrite _error, which has been set by GetLastError() in the + // Overwrite error, which has been set by GetLastError() in the // SystemException constructor, with WSAGetLastError() // - _error = WSAGetLastError(); + error = WSAGetLastError(); #endif } @@ -589,10 +548,10 @@ Ice::SocketException::_name() const return "Ice::SocketException"; } -string -Ice::SocketException::_description() const +ostream& +Ice::SocketException::_print(ostream& out) const { - return "system exception: " + errorToString(_error); + return IceUtil::printException(out, *this); } LocalException* @@ -630,10 +589,10 @@ Ice::TimeoutException::_name() const return "Ice::TimeoutException"; } -string -Ice::TimeoutException::_description() const +ostream& +Ice::TimeoutException::_print(ostream& out) const { - return "timeout while sending or receiving data"; + return IceUtil::printException(out, *this); } LocalException* @@ -671,10 +630,10 @@ Ice::ConnectTimeoutException::_name() const return "Ice::ConnectTimeoutException"; } -string -Ice::ConnectTimeoutException::_description() const +ostream& +Ice::ConnectTimeoutException::_print(ostream& out) const { - return "timeout while establishing a connection"; + return IceUtil::printException(out, *this); } LocalException* @@ -712,10 +671,10 @@ Ice::ConnectFailedException::_name() const return "Ice::ConnectFailedException"; } -string -Ice::ConnectFailedException::_description() const +ostream& +Ice::ConnectFailedException::_print(ostream& out) const { - return "connect failed: " + errorToString(_error); + return IceUtil::printException(out, *this); } LocalException* @@ -753,19 +712,10 @@ Ice::ConnectionLostException::_name() const return "Ice::ConnectionLostException"; } -string -Ice::ConnectionLostException::_description() const +ostream& +Ice::ConnectionLostException::_print(ostream& out) const { - string s = "connection lost: "; - if (_error == 0) - { - s += "recv() returned zero"; - } - else - { - s += errorToString(_error); - } - return s; + return IceUtil::printException(out, *this); } LocalException* @@ -784,7 +734,7 @@ Ice::DNSException::DNSException(const char* file, int line) : SystemException(file, line) { #ifndef WIN32 - _error = h_errno; + error = h_errno; #endif } @@ -806,10 +756,10 @@ Ice::DNSException::_name() const return "Ice::DNSException"; } -string -Ice::DNSException::_description() const +ostream& +Ice::DNSException::_print(ostream& out) const { - return "DNS error: " + errorToStringDNS(_error); + return IceUtil::printException(out, *this); } LocalException* @@ -864,10 +814,10 @@ Ice::UnmarshalOutOfBoundsException::_name() const return "Ice::UnmarshalOutOfBoundsException"; } -string -Ice::UnmarshalOutOfBoundsException::_description() const +ostream& +Ice::UnmarshalOutOfBoundsException::_print(ostream& out) const { - return "protocol error: out of bounds during unmarshaling"; + return IceUtil::printException(out, *this); } LocalException* @@ -905,10 +855,10 @@ Ice::ServantUnmarshalException::_name() const return "Ice::ServantUnmarshalException"; } -string -Ice::ServantUnmarshalException::_description() const +ostream& +Ice::ServantUnmarshalException::_print(ostream& out) const { - return "protocol error: servant type does not match signature"; + return IceUtil::printException(out, *this); } LocalException* @@ -946,10 +896,10 @@ Ice::StringEncodingException::_name() const return "Ice::StringEncodingException"; } -string -Ice::StringEncodingException::_description() const +ostream& +Ice::StringEncodingException::_print(ostream& out) const { - return "protocol error: string encoding error"; + return IceUtil::printException(out, *this); } LocalException* @@ -987,10 +937,10 @@ Ice::MemoryLimitException::_name() const return "Ice::MemoryLimitException"; } -string -Ice::MemoryLimitException::_description() const +ostream& +Ice::MemoryLimitException::_print(ostream& out) const { - return "protocol error: memory limit exceeded"; + return IceUtil::printException(out, *this); } LocalException* @@ -1028,10 +978,10 @@ Ice::EncapsulationException::_name() const return "Ice::EncapsulationException"; } -string -Ice::EncapsulationException::_description() const +ostream& +Ice::EncapsulationException::_print(ostream& out) const { - return "protocol error: illegal encapsulation"; + return IceUtil::printException(out, *this); } LocalException* @@ -1069,10 +1019,10 @@ Ice::UnsupportedProtocolException::_name() const return "Ice::UnsupportedProtocolException"; } -string -Ice::UnsupportedProtocolException::_description() const +ostream& +Ice::UnsupportedProtocolException::_print(ostream& out) const { - return "protocol error: unsupported protocol version"; + return IceUtil::printException(out, *this); } LocalException* @@ -1110,10 +1060,10 @@ Ice::UnsupportedEncodingException::_name() const return "Ice::UnsupportedEncodingException"; } -string -Ice::UnsupportedEncodingException::_description() const +ostream& +Ice::UnsupportedEncodingException::_print(ostream& out) const { - return "protocol error: unsupported encoding version"; + return IceUtil::printException(out, *this); } LocalException* @@ -1151,10 +1101,10 @@ Ice::InvalidMessageException::_name() const return "Ice::InvalidMessageException"; } -string -Ice::InvalidMessageException::_description() const +ostream& +Ice::InvalidMessageException::_print(ostream& out) const { - return "protocol error: invalid message type"; + return IceUtil::printException(out, *this); } LocalException* @@ -1192,10 +1142,10 @@ Ice::UnknownMessageException::_name() const return "Ice::UnknownMessageException"; } -string -Ice::UnknownMessageException::_description() const +ostream& +Ice::UnknownMessageException::_print(ostream& out) const { - return "protocol error: unknown message type"; + return IceUtil::printException(out, *this); } LocalException* @@ -1233,10 +1183,10 @@ Ice::UnknownRequestIdException::_name() const return "Ice::UnknownRequestIdException"; } -string -Ice::UnknownRequestIdException::_description() const +ostream& +Ice::UnknownRequestIdException::_print(ostream& out) const { - return "protocol error: unknown request id"; + return IceUtil::printException(out, *this); } LocalException* @@ -1274,10 +1224,10 @@ Ice::UnknownReplyStatusException::_name() const return "Ice::UnknownReplyStatusException"; } -string -Ice::UnknownReplyStatusException::_description() const +ostream& +Ice::UnknownReplyStatusException::_print(ostream& out) const { - return "protocol error: unknown reply status"; + return IceUtil::printException(out, *this); } LocalException* @@ -1315,10 +1265,10 @@ Ice::CloseConnectionException::_name() const return "Ice::CloseConnectionException"; } -string -Ice::CloseConnectionException::_description() const +ostream& +Ice::CloseConnectionException::_print(ostream& out) const { - return "protocol error: connection closed by server"; + return IceUtil::printException(out, *this); } LocalException* @@ -1356,10 +1306,10 @@ Ice::AbortBatchRequestException::_name() const return "Ice::AbortBatchRequestException"; } -string -Ice::AbortBatchRequestException::_description() const +ostream& +Ice::AbortBatchRequestException::_print(ostream& out) const { - return "protocol error: batch request was aborted"; + return IceUtil::printException(out, *this); } LocalException* diff --git a/cpp/src/Ice/Makefile b/cpp/src/Ice/Makefile index cdc1fc7cb36..5890e09124f 100644 --- a/cpp/src/Ice/Makefile +++ b/cpp/src/Ice/Makefile @@ -19,6 +19,7 @@ VERSIONED_NAME = $(top_srcdir)/lib/$(VERSIONED_BASE) TARGETS = $(NAME) $(VERSIONED_NAME) OBJS = Application.o \ + Exception.o \ LocalException.o \ Properties.o \ PropertiesI.o \ diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 1f1f0e61156..4b198288217 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -9,7 +9,7 @@ // ********************************************************************** #include <Ice/Network.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 5b68982b15e..dcf7e558c1d 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -15,7 +15,7 @@ #include <Ice/Reference.h> #include <Ice/Endpoint.h> #include <Ice/Collector.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> #include <Ice/Properties.h> #include <Ice/Functional.h> diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h index 81233e4ed59..04e21adf5ef 100644 --- a/cpp/src/Ice/ObjectAdapterI.h +++ b/cpp/src/Ice/ObjectAdapterI.h @@ -19,7 +19,7 @@ #include <Ice/CollectorF.h> #include <Ice/ProxyF.h> #include <Ice/ObjectF.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> namespace Ice { diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index e8811a6a076..942e72c27f1 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -12,7 +12,7 @@ #include <Ice/Object.h> #include <Ice/Emitter.h> #include <Ice/Reference.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/PicklerI.cpp b/cpp/src/Ice/PicklerI.cpp index d2600e6b39b..42d8ba0442d 100644 --- a/cpp/src/Ice/PicklerI.cpp +++ b/cpp/src/Ice/PicklerI.cpp @@ -10,7 +10,7 @@ #include <Ice/PicklerI.h> #include <Ice/BasicStream.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> #include <Ice/Protocol.h> using namespace std; diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 62bf6f330b0..c7d82b04bce 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -9,7 +9,7 @@ // ********************************************************************** #include <Ice/PropertiesI.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> #include <fstream> using namespace std; diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 3d8239ccb16..982401ba4c3 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -20,7 +20,7 @@ #include <Ice/TraceLevels.h> #include <Ice/Emitter.h> #include <Ice/BasicStream.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> #include <Ice/Functional.h> using namespace std; @@ -434,7 +434,7 @@ IceDelegateM::Ice::Object::_isA(const string& s) __os->write(s); if (!__out.invoke()) { - throw ::Ice::UnknownUserException(__FILE__, __LINE__); + throw ::Ice::UserException(__FILE__, __LINE__); } bool __ret; __is->read(__ret); @@ -449,7 +449,7 @@ IceDelegateM::Ice::Object::_ping() __os->write("_ping"); if (!__out.invoke()) { - throw ::Ice::UnknownUserException(__FILE__, __LINE__); + throw ::Ice::UserException(__FILE__, __LINE__); } } diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index b21a99e7e9a..b19f6b7a578 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -11,7 +11,7 @@ #include <Ice/Reference.h> #include <Ice/Endpoint.h> #include <Ice/BasicStream.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/SslAcceptor.cpp b/cpp/src/Ice/SslAcceptor.cpp index 1c141f89721..9e0a3d2041a 100644 --- a/cpp/src/Ice/SslAcceptor.cpp +++ b/cpp/src/Ice/SslAcceptor.cpp @@ -14,7 +14,7 @@ #include <Ice/TraceLevels.h> #include <Ice/Logger.h> #include <Ice/Network.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/SslConnector.cpp b/cpp/src/Ice/SslConnector.cpp index d432ab8dfb5..7ffb7f0c797 100644 --- a/cpp/src/Ice/SslConnector.cpp +++ b/cpp/src/Ice/SslConnector.cpp @@ -14,7 +14,7 @@ #include <Ice/TraceLevels.h> #include <Ice/Logger.h> #include <Ice/Network.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/SslTransceiver.cpp b/cpp/src/Ice/SslTransceiver.cpp index 9783ef0745b..e19dd35b002 100644 --- a/cpp/src/Ice/SslTransceiver.cpp +++ b/cpp/src/Ice/SslTransceiver.cpp @@ -14,7 +14,7 @@ #include <Ice/Logger.h> #include <Ice/Buffer.h> #include <Ice/Network.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/TcpAcceptor.cpp b/cpp/src/Ice/TcpAcceptor.cpp index 428cee5b35a..73b19611565 100644 --- a/cpp/src/Ice/TcpAcceptor.cpp +++ b/cpp/src/Ice/TcpAcceptor.cpp @@ -14,7 +14,7 @@ #include <Ice/TraceLevels.h> #include <Ice/Logger.h> #include <Ice/Network.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/TcpConnector.cpp b/cpp/src/Ice/TcpConnector.cpp index e7d9b65185f..c9de0b46942 100644 --- a/cpp/src/Ice/TcpConnector.cpp +++ b/cpp/src/Ice/TcpConnector.cpp @@ -14,7 +14,7 @@ #include <Ice/TraceLevels.h> #include <Ice/Logger.h> #include <Ice/Network.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp index b1698f38d61..8df656982e0 100644 --- a/cpp/src/Ice/TcpTransceiver.cpp +++ b/cpp/src/Ice/TcpTransceiver.cpp @@ -14,7 +14,7 @@ #include <Ice/Logger.h> #include <Ice/Buffer.h> #include <Ice/Network.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 8c0430f61aa..370a2d02482 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -11,7 +11,7 @@ #include <Ice/ThreadPool.h> #include <Ice/EventHandler.h> #include <Ice/Network.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> #include <Ice/Instance.h> #include <Ice/Properties.h> #include <Ice/Logger.h> diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index b917693f52d..e716f67eb16 100644 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -14,7 +14,7 @@ #include <Ice/Logger.h> #include <Ice/Buffer.h> #include <Ice/Network.h> -#include <Ice/LocalException.h> +#include <Ice/Exception.h> using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/ice.dsp b/cpp/src/Ice/ice.dsp index 87cde1982f9..84e245640d7 100644 --- a/cpp/src/Ice/ice.dsp +++ b/cpp/src/Ice/ice.dsp @@ -152,6 +152,10 @@ SOURCE=.\Instance.cpp # End Source File
# Begin Source File
+SOURCE=.\Exception.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\LocalException.cpp
# End Source File
# Begin Source File
@@ -384,6 +388,10 @@ SOURCE=..\..\include\Ice\InstanceF.h # End Source File
# Begin Source File
+SOURCE=..\..\include\Ice\Exception.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\Ice\LocalException.h
# End Source File
# Begin Source File
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index fce011562b9..4404da545c9 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -107,7 +107,7 @@ Slice::Gen::generate(const UnitPtr& unit) H << "\n#include <Ice/Outgoing.h>"; H << "\n#include <Ice/Incoming.h>"; H << "\n#include <Ice/Direct.h>"; - H << "\n#include <Ice/LocalException.h>"; + H << "\n#include <Ice/Exception.h>"; } else { @@ -1042,12 +1042,12 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) C << eb; } C << eb; - C << nl << "throw ::Ice::UnknownUserException(__FILE__, __LINE__);"; + C << nl << "throw ::Ice::UserException(__FILE__, __LINE__);"; } else */ { - C << nl << "throw ::Ice::UnknownUserException(__FILE__, __LINE__);"; + C << nl << "throw ::Ice::UserException(__FILE__, __LINE__);"; } C << eb; writeAllocateCode(C, TypeStringList(), ret); |