TIDNaming::NamingContextFileIOFactory::NamingContextFileIOFactory( const char * path) throw (InvalidPathException) { try { m_writer = new TIDNaming::NamingContextFileWriter(path); m_reader = new TIDNaming::NamingContextFileReader(path); } catch (NamingInternals::PersistenceException&) { throw InvalidPathException(path); } }
void AmqpException::Throw(const amqp_connection_close_t& reply) { std::ostringstream what; const char* method_name = amqp_method_name(((reply.class_id << 16) | reply.method_id)); std::string reply_text; if (reply.reply_text.bytes != NULL) { reply_text = std::string((char*)reply.reply_text.bytes, reply.reply_text.len); } if (method_name != NULL) { what << "connection error: " << reply.reply_code << ": " << method_name << " caused: " << reply_text; } else { what << "connection error: " << reply.reply_code << ": " << reply_text; } switch (reply.reply_code) { case ConnectionForcedException::REPLY_CODE: throw ConnectionForcedException(what.str(), reply_text, reply.class_id, reply.method_id); case InvalidPathException::REPLY_CODE: throw InvalidPathException(what.str(), reply_text, reply.class_id, reply.method_id); case FrameErrorException::REPLY_CODE: throw FrameErrorException(what.str(), reply_text, reply.class_id, reply.method_id); case SyntaxErrorException::REPLY_CODE: throw SyntaxErrorException(what.str(), reply_text, reply.class_id, reply.method_id); case CommandInvalidException::REPLY_CODE: throw CommandInvalidException(what.str(), reply_text, reply.class_id, reply.method_id); case ChannelErrorException::REPLY_CODE: throw ChannelErrorException(what.str(), reply_text, reply.class_id, reply.method_id); case UnexpectedFrameException::REPLY_CODE: throw UnexpectedFrameException(what.str(), reply_text, reply.class_id, reply.method_id); case ResourceErrorException::REPLY_CODE: throw ResourceErrorException(what.str(), reply_text, reply.class_id, reply.method_id); case NotAllowedException::REPLY_CODE: throw NotAllowedException(what.str(), reply_text, reply.class_id, reply.method_id); case NotImplementedException::REPLY_CODE: throw NotImplementedException(what.str(), reply_text, reply.class_id, reply.method_id); case InternalErrorException::REPLY_CODE: throw InternalErrorException(what.str(), reply_text, reply.class_id, reply.method_id); default: throw std::logic_error(std::string("Programming error: unknown connection reply code: ").append(boost::lexical_cast<std::string>(reply.reply_code))); } }