// ********************************************************************** // // Copyright (c) 2002 // ZeroC, Inc. // Billerica, MA, USA // // All Rights Reserved. // // Ice is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License version 2 as published by // the Free Software Foundation. // // ********************************************************************** #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; void Ice::UserException::ice_marshal(const ::std::string& __name, const ::Ice::StreamPtr& __os) { __os->startWriteException(__name); __marshal(__os); __os->endWriteException(); } Ice::LocalException::LocalException(const char* file, int line) : Exception(file, line) { } void Ice::UnknownException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunknown exception"; if(!unknown.empty()) { out << "\nunknown exception text:\n" << unknown; } } void Ice::UnknownLocalException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunknown local exception"; if(!unknown.empty()) { out << "\nunknown local exception text:\n" << unknown; } } void Ice::UnknownUserException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunknown user exception"; if(!unknown.empty()) { out << "\nunknown user exception text:\n" << unknown; } } void Ice::VersionMismatchException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nIce library version mismatch"; } void Ice::CommunicatorDestroyedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\ncommunicator object destroyed"; } void Ice::ObjectAdapterDeactivatedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nobject adapter `" << name << "' deactivated"; } void Ice::ObjectAdapterIdInUseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nobject adapter with id `" << id << "' is already in use"; } void Ice::NoEndpointException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nno suitable endpoint available for proxy `" << proxy << "'"; } void Ice::EndpointParseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nerror while parsing endpoint `" << str << "'"; } void Ice::IdentityParseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nerror while parsing identity `" << str << "'"; } void Ice::ProxyParseException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nerror while parsing proxy `" << str << "'"; } void Ice::IllegalIdentityException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nillegal identity: `" << id << "'"; } static void printFailedRequestData(ostream& out, const RequestFailedException& ex) { out << "\nidentity: " << ex.id; out << "\nfacet: "; vector::const_iterator p = ex.facet.begin(); while(p != ex.facet.end()) { out << encodeString(*p++, "/"); if(p != ex.facet.end()) { out << '/'; } } out << "\noperation: " << ex.operation; } void Ice::RequestFailedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nrequest failed"; printFailedRequestData(out, *this); } void Ice::ObjectNotExistException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nobject does not exist"; printFailedRequestData(out, *this); } void Ice::FacetNotExistException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nfacet does not exist"; printFailedRequestData(out, *this); } void Ice::OperationNotExistException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\noperation does not exist"; printFailedRequestData(out, *this); } void Ice::SyscallException::ice_print(ostream& out) const { Exception::ice_print(out); if(error != 0) { out << ":\nsyscall exception: " << errorToString(error); } } void Ice::SocketException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nsocket exception: " << errorToString(error); } void Ice::ConnectFailedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nconnect failed: " << errorToString(error); } void Ice::ConnectionLostException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nconnection lost: "; if(error == 0) { out << "recv() returned zero"; } else { out << errorToString(error); } } void Ice::DNSException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nDNS error: " << errorToStringDNS(error) << "\nhost: " << host; } void Ice::TimeoutException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\ntimeout while sending or receiving data"; } void Ice::ConnectTimeoutException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\ntimeout while establishing a connection"; } void Ice::ConnectionTimeoutException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nconnection has timed out"; } void Ice::ProtocolException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nunknown protocol exception"; } void Ice::UnsupportedProtocolException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unsupported protocol version"; } void Ice::UnsupportedEncodingException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unsupported encoding version"; } void Ice::UnknownMessageException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unknown message type"; } void Ice::ConnectionNotValidatedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: received message over unvalidated connection"; } void Ice::UnknownRequestIdException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unknown request id"; } void Ice::UnknownReplyStatusException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: unknown reply status"; } void Ice::CloseConnectionException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: connection closed"; } void Ice::AbortBatchRequestException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: batch request was aborted"; } void Ice::IllegalMessageSizeException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: illegal message size"; } void Ice::CompressionNotSupportedException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: compressed messages not supported"; } void Ice::CompressionException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: failed to compress or uncompress data"; if(!reason.empty()) { out << ":\n" << reason; } } void Ice::MarshalException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: error during unmarshaling"; } void Ice::NoObjectFactoryException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: no suitable object factory found for `" << type << "'"; } void Ice::NoUserExceptionFactoryException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: no suitable user exception factory found for `" << type << "'"; } void Ice::UnmarshalOutOfBoundsException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: out of bounds during unmarshaling"; } void Ice::ProxyUnmarshalException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: inconsistent proxy data during unmarshaling"; } void Ice::IllegalIndirectionException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: encountered illegal protocol indirection"; } void Ice::MemoryLimitException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: memory limit exceeded"; } void Ice::EncapsulationException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: illegal encapsulation"; } void Ice::NegativeSizeException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: negative size for sequence, dictionary, etc."; } void Ice::PluginInitializationException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nplug-in initialization failed"; if(!reason.empty()) { out << ": " << reason; } } void Ice::CollocationOptimizationException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nrequested feature not available with collocation optimization"; } void Ice::AlreadyRegisteredException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n" << kindOfObject << " already registered under ID `" << id << "'"; } void Ice::NotRegisteredException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n no " << kindOfObject << " registered under ID `" << id << "'"; } void Ice::TwowayOnlyException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\n operation `" << operation << "' can only be invoked as a twoway request"; }