Kea  2.1.2-git
isc::Exception Class Reference

This is a base class for exceptions thrown from the DNS library module. More...

#include <exceptions.h>

+ Inheritance diagram for isc::Exception:

Public Member Functions

Constructors and Destructor
 Exception (const char *file, size_t line, const char *what)
 Constructor for a given type for exceptions with file name and file line number. More...
 
 Exception (const char *file, size_t line, const std::string &what)
 Constructor for a given type for exceptions with file name and file line number. More...
 
virtual ~Exception () throw ()
 The destructor. More...
 
Methods Reimplemented against the Standard Exception Class
virtual const char * what () const throw ()
 Returns a C-style character string of the cause of the exception. More...
 
virtual const char * what (bool verbose) const throw ()
 Returns a C-style character string of the cause of exception. More...
 
Getter Methods
const std::string & getMessage () const
 Gets a string describing the cause of the exception. More...
 
const char * getFile () const
 Gets the file name where the exception was thrown. More...
 
size_t getLine () const
 Gets the line number of the file where the exception was thrown. More...
 

Detailed Description

This is a base class for exceptions thrown from the DNS library module.

Normally, the exceptions are thrown via a convenient shortcut macro, isc_throw, which automatically gives trivial parameters for the exception such as the file name and line number where the exception is triggered.

Definition at line 23 of file exceptions/exceptions.h.

Constructor & Destructor Documentation

◆ Exception() [1/2]

isc::Exception::Exception ( const char *  file,
size_t  line,
const char *  what 
)

Constructor for a given type for exceptions with file name and file line number.

Parameters
filethe file name where the exception was thrown.
linethe line in file where the exception was thrown.
whata description (type) of the exception.

Definition at line 17 of file exceptions/exceptions.cc.

◆ Exception() [2/2]

isc::Exception::Exception ( const char *  file,
size_t  line,
const std::string &  what 
)

Constructor for a given type for exceptions with file name and file line number.

Parameters
filethe file name where the exception was thrown.
linethe line in file where the exception was thrown.
whata description (type) of the exception.

Definition at line 24 of file exceptions/exceptions.cc.

◆ ~Exception()

virtual isc::Exception::~Exception ( )
throw (
)
inlinevirtual

The destructor.

Definition at line 46 of file exceptions/exceptions.h.

References getMessage(), and what().

+ Here is the call graph for this function:

Member Function Documentation

◆ getFile()

const char* isc::Exception::getFile ( ) const
inline

Gets the file name where the exception was thrown.

Returns
a C-style string of the file name.

Definition at line 90 of file exceptions/exceptions.h.

Referenced by isc::util::unittests::run_all().

◆ getLine()

size_t isc::Exception::getLine ( ) const
inline

Gets the line number of the file where the exception was thrown.

Returns
an integer specifying the line number.

Definition at line 95 of file exceptions/exceptions.h.

Referenced by isc::util::unittests::run_all().

◆ getMessage()

const std::string& isc::Exception::getMessage ( ) const
inline

Gets a string describing the cause of the exception.

Returns
the cause string.

Definition at line 85 of file exceptions/exceptions.h.

Referenced by ~Exception().

◆ what() [1/2]

const char * isc::Exception::what ( ) const
throw (
)
virtual

Returns a C-style character string of the cause of the exception.

Note: we normally don't use exception specifications, but this is an "exception" to that policy as it's enforced by the base class.

Returns
A C-style character string of the exception cause.

Definition at line 32 of file exceptions/exceptions.cc.

Referenced by isc::asiolink::IOSignalSetImpl::add(), isc::util::StateSet::add(), isc::dhcp::RelayInfoParser::addAddress(), isc::d2::NameChangeTransaction::addDhcidRdata(), isc::dhcp::CqlLeaseMgr::addLease(), isc::dhcp::MySqlLeaseMgr::addLease(), isc::d2::NameChangeTransaction::addLeaseAddressRdata(), isc::d2::NameChangeTransaction::addPtrRdata(), isc::dhcp::AllocEngine::allocateLease4(), isc::dhcp::AllocEngine::allocateLeases6(), isc::log::Formatter< Logger >::arg(), isc::dhcp::Dhcpv4Srv::assignLease(), isc::http::HttpConnection::asyncAccept(), isc::db::CqlCommon::bindData(), buffer4_receive(), isc::ha::HAImpl::buffer4Receive(), isc::ha::HAImpl::buffer6Receive(), isc::http::BasicHttpAuthConfig::checkAuth(), isc::process::DControllerBase::checkConfigOnly(), isc::ha::HAService::checkPermissionsClientAndListener(), isc::d2::D2Process::checkQueueStatus(), isc::dhcp::Dhcpv4Exchange::classifyPacket(), isc::dhcp::ControlledDhcpv6Srv::cleanup(), isc::netconf::HttpControlSocket::configSet(), isc::netconf::UnixControlSocket::configSet(), isc::asiolink::TlsContextBase::configure(), isc::agent::CtrlAgentProcess::configure(), isc::process::DControllerBase::configWriteHandler(), isc::dhcp::PgSqlLease4Exchange::convertFromDatabase(), isc::dhcp::PgSqlLease6Exchange::convertFromDatabase(), isc::http::HttpRequest::create(), isc::http::HttpResponse::create(), isc::dhcp::CqlLease4Exchange::createBindForDelete(), isc::dhcp::CqlHostExchange::createBindForDelete(), isc::dhcp::CqlLease6Exchange::createBindForDelete(), isc::dhcp::CqlLease4Exchange::createBindForInsert(), isc::dhcp::CqlLease6Exchange::createBindForInsert(), isc::dhcp::CqlHostExchange::createBindForMutation(), isc::dhcp::MySqlLease4Exchange::createBindForSend(), isc::dhcp::PgSqlLease4Exchange::createBindForSend(), isc::dhcp::PgSqlLease6Exchange::createBindForSend(), isc::dhcp::MySqlLease6Exchange::createBindForSend(), isc::dhcp::CqlLease4Exchange::createBindForUpdate(), isc::dhcp::CqlLease6Exchange::createBindForUpdate(), isc::dhcp::CfgOption::createDescriptorOption(), isc::dhcp::OptionDataParser::createOption(), isc::dhcp::PacketQueueMgr< PacketQueue4Ptr >::createPacketQueue(), isc::dns::rdata::createRdata(), isc::dhcp::SubnetConfigParser::createSubnet(), isc::dhcp::Dhcpv4Srv::declineLease(), isc::dhcp::Dhcpv6Srv::declineLease(), isc::util::StateModel::defineEvent(), isc::util::StateModel::defineState(), isc::dhcp::CqlLeaseMgr::deleteLease(), isc::yang::TranslatorBasic::delItem(), isc::http::HttpConnection::doHandshake(), isc::dhcp::Dhcpv6Srv::evaluateClasses(), isc::config::CmdsImpl::extractCommand(), isc::dhcp::OptionDataParser::extractSpace(), isc::dhcp::OptionDefinition::factoryOpaqueDataTuples(), isc::cryptolink::HashImpl::final(), isc::dhcp_ddns::D2Dhcid::fromDUID(), isc::dhcp_ddns::NameChangeRequest::fromFormat(), isc::dhcp_ddns::NameChangeRequest::fromJSON(), isc::dhcp_ddns::D2Dhcid::fromStr(), isc::dns::rdata::generic::Generic::Generic(), isc::data::SimpleParser::getAddress(), isc::yang::TranslatorClass::getClass(), isc::yang::TranslatorClasses::getClasses(), isc::db::PgSqlExchange::getColumnValue(), isc::yang::TranslatorConfig::getConfig(), isc::yang::TranslatorControlSocket::getControlSocket(), isc::db::CqlCommon::getData(), isc::yang::TranslatorDatabase::getDatabase(), isc::yang::TranslatorDatabases::getDatabases(), isc::http::BasicHttpAuthConfig::getFileContent(), isc::http::HttpMessage::getHeaderValueAsUint64(), isc::yang::TranslatorHost::getHost(), isc::dhcp::MySqlHostDataSourceImpl::getHostCollection(), isc::db::PgSqlExchange::getInetValue4(), isc::db::PgSqlExchange::getInetValue6(), isc::db::PgSqlExchange::getIPv6Value(), isc::yang::TranslatorBasic::getItem(), isc::yang::TranslatorBasic::getItems(), isc::http::HttpResponseJson::getJsonElement(), isc::http::PostHttpRequestJson::getJsonElement(), isc::dhcp::OptionDataTypeUtil::getLabelCount(), isc::yang::TranslatorLogger::getLogger(), isc::yang::TranslatorLoggers::getLoggers(), isc::netconf::NetconfAgent::getModules(), isc::yang::TranslatorOptionData::getOptionData(), isc::yang::TranslatorOptionDataList::getOptionDataList(), isc::yang::TranslatorOptionDef::getOptionDef(), isc::yang::TranslatorOptionDefList::getOptionDefList(), isc::yang::TranslatorPdPool::getPdPool(), isc::yang::TranslatorPdPools::getPdPools(), isc::perfdhcp::Receiver::getPkt(), isc::yang::TranslatorPool::getPool(), isc::yang::TranslatorPools::getPools(), isc::yang::TranslatorSharedNetwork::getSharedNetwork(), isc::yang::TranslatorSubnet::getSubnet(), isc::yang::TranslatorBasic::getValuesFromItems(), isc::agent::CtrlAgentCommandMgr::handleCommand(), isc::cryptolink::HashImpl::HashImpl(), isc::cryptolink::HMACImpl::HMACImpl(), isc::dhcp::IfaceMgr::IfaceMgr(), isc::util::StateModel::initDictionaries(), isc::cryptolink::CryptoLink::initialize(), isc::process::DControllerBase::initProcess(), isc::netconf::NetconfAgent::initSysrepo(), isc::dhcp::CqlHostDataSourceImpl::insertOrDeleteHost(), isc::dhcp_ddns::NameChangeListener::invokeRecvHandler(), isc::dhcp_ddns::NameChangeSender::invokeSendHandler(), isc::lfc::LFCController::launch(), isc::process::DControllerBase::launch(), isc::dhcp::Memfile_LeaseMgr::lfcCallback(), isc::dhcp::ControlledDhcpv4Srv::loadConfigFile(), isc::dhcp::ControlledDhcpv6Srv::loadConfigFile(), isc::dns::MasterLoader::MasterLoaderImpl::loadIncremental(), main(), user_chk::UserFile::makeUser(), isc::util::CSVFile::next(), isc::config::CommandMgrImpl::openCommandSocket(), isc::db::CqlConnection::openDatabase(), isc::dhcp::IfaceMgr::openSocketFromRemoteAddress(), isc::dhcp::IfaceMgr::openSockets4(), isc::dhcp::IfaceMgr::openSockets6(), isc::d2::DNSClientImpl::operator()(), isc::dhcp::OptionDefinition::optionFactory(), isc::perfdhcp::PktTransform::pack(), isc::dhcp::Pkt4::pack(), isc::dhcp::Pkt6::packUDP(), isc::process::ConfigControlParser::parse(), isc::ha::HAConfigParser::parse(), isc::dhcp::DUIDConfigParser::parse(), isc::dhcp::SharedNetwork4Parser::parse(), isc::dhcp::IfacesConfigParser::parse(), isc::dhcp::ExpirationConfigParser::parse(), isc::dhcp::SharedNetworksListParser< SharedNetworkParserType >::parse(), isc::dhcp::ExpressionParser::parse(), isc::dhcp::SharedNetwork6Parser::parse(), isc::dhcp::ClientClassDefParser::parse(), isc::netconf::NetconfCfgMgr::parse(), isc::http::BasicHttpAuthConfig::parse(), isc::dhcp::MACSourcesListConfigParser::parse(), isc::dhcp::OptionDefParser::parse(), isc::dhcp::OptionDefListParser::parse(), isc::agent::CtrlAgentCfgMgr::parse(), isc::netconf::ControlSocketConfigParser::parse(), isc::dhcp::PoolParser::parse(), isc::d2::D2CfgMgr::parse(), isc::netconf::ServerConfigParser::parse(), isc::dhcp::SubnetConfigParser::parse(), isc::dhcp::Subnets4ListConfigParser::parse(), isc::d2::TSIGKeyInfoParser::parse(), isc::dhcp::PdPoolParser::parse(), isc::dhcp::Subnets6ListConfigParser::parse(), isc::dhcp::D2ClientConfigParser::parse(), isc::http::PostHttpRequestJson::parseBodyAsJson(), isc::http::HttpResponseJson::parseBodyAsJson(), isc::dhcp::HostReservationParser4::parseInternal(), isc::dhcp::HostReservationParser6::parseInternal(), isc::dhcp::HostReservationIdsParser::parseInternal(), isc::dhcp::Option4ClientFqdnImpl::parseWireData(), isc::util::io::SocketSessionReceiver::pop(), isc::dhcp::Dhcpv4Srv::postAllocateNameUpdate(), isc::dhcp::CqlHostExchange::prepareExchange(), isc::hooks::LibraryManager::prepareUnloadLibrary(), isc::d2::NameChangeTransaction::prepNewRequest(), isc::dhcp::Dhcpv4Srv::processClientName(), isc::dhcp::ControlledDhcpv6Srv::processCommand(), isc::dhcp::ControlledDhcpv4Srv::processCommand(), isc::config::BaseCommandMgr::processCommand(), isc::dhcp::Dhcpv6Srv::processPacket(), isc::dhcp::Dhcpv4Srv::processPacket(), isc::dhcp::Dhcpv4Srv::processRelease(), isc::util::CSVRow::readAndConvertAt(), isc::dhcp::OptionDataTypeUtil::readFqdn(), isc::dhcp::OptionDataTypeUtil::readPrefix(), isc::dhcp::OptionDataTypeUtil::readTuple(), isc::dhcp_ddns::NameChangeUDPListener::receiveCompletionHandler(), isc::d2::D2Process::reconfigureQueueMgr(), isc::util::CSVFile::recreate(), user_chk::UserRegistry::refresh(), isc::asiolink::IOSignalSetImpl::remove(), isc::db::AnyArray::remove(), isc::dhcp::AllocEngine::renewLeases6(), isc::dhcp::Dhcpv6Srv::requiredClassify(), isc::dhcp::Dhcpv4Srv::requiredClassify(), isc::dhcp::CqlLease4Exchange::retrieve(), isc::dhcp::CqlHostExchange::retrieve(), isc::dhcp::CqlLease6Exchange::retrieve(), isc::dhcp::CqlHostExchange::retrieveOption(), isc::d2::D2CfgMgr::reverseIpAddress(), isc::netconf::NetconfProcess::run(), isc::agent::CtrlAgentProcess::run(), isc::d2::D2Process::run(), isc::util::unittests::run_all(), isc::hooks::LibraryManager::runLoad(), isc::dhcp::Dhcpv6Srv::sanityCheck(), isc::util::str::StringSanitizerImpl::scrub(), isc::db::MySqlConnection::selectQuery(), isc::db::PgSqlConnection::selectQuery(), isc::dhcp::AuthKey::setAuthKey(), isc::dhcp_ddns::NameChangeRequest::setChangeType(), isc::yang::TranslatorClass::setClass(), isc::yang::TranslatorClasses::setClasses(), isc::yang::TranslatorConfig::setConfig(), isc::dhcp_ddns::NameChangeRequest::setConflictResolution(), isc::yang::TranslatorControlSocket::setControlSocket(), isc::yang::TranslatorDatabase::setDatabase(), isc::yang::TranslatorDatabases::setDatabases(), isc::dhcp_ddns::NameChangeRequest::setForwardChange(), isc::dhcp_ddns::NameChangeRequest::setFqdn(), isc::yang::TranslatorHost::setHost(), isc::yang::TranslatorHosts::setHosts(), isc::yang::TranslatorBasic::setItem(), isc::dhcp_ddns::NameChangeRequest::setLeaseLength(), isc::yang::TranslatorLogger::setLogger(), isc::yang::TranslatorLoggers::setLoggers(), isc::yang::TranslatorOptionData::setOptionData(), isc::yang::TranslatorOptionDataList::setOptionDataList(), isc::yang::TranslatorOptionDef::setOptionDef(), isc::yang::TranslatorOptionDefList::setOptionDefList(), isc::yang::TranslatorPdPool::setPdPool(), isc::yang::TranslatorPdPools::setPdPools(), isc::yang::TranslatorPool::setPool(), isc::yang::TranslatorPools::setPools(), isc::dhcp_ddns::NameChangeRequest::setReverseChange(), isc::asiolink::IntervalTimerImpl::setup(), isc::cryptolink::HMACImpl::sign(), isc::config::CmdHttpListener::start(), isc::http::HttpListenerImpl::start(), isc::d2::D2QueueMgr::startListening(), isc::dhcp_ddns::NameChangeListener::startListening(), isc::dhcp_ddns::NameChangeSender::startSending(), isc::stat_cmds::LeaseStatCmdsImpl::statLease4GetHandler(), isc::stat_cmds::LeaseStatCmdsImpl::statLease6GetHandler(), isc::dhcp_ddns::NameChangeListener::stopListening(), isc::dhcp_ddns::NameChangeSender::stopSending(), isc::util::str::StringSanitizerImpl::StringSanitizerImpl(), isc::d2::TSIGKeyInfo::stringToAlgorithmName(), isc::config::JSONFeed::toElement(), isc::dns::TSIGKey::TSIGKey(), isc::perfdhcp::PktTransform::unpack(), isc::cryptolink::HashImpl::update(), isc::cryptolink::HMACImpl::update(), isc::dhcp::CqlLeaseMgr::updateLease4(), isc::dhcp::CqlLeaseMgr::updateLease6(), isc::ha::HAConfig::validate(), isc::cryptolink::HMACImpl::verify(), isc::dhcp::OptionDataTypeUtil::writeBinary(), isc::dhcp::OptionDataTypeUtil::writeFqdn(), ~Exception(), and isc::cryptolink::RNGImpl::~RNGImpl().

◆ what() [2/2]

const char * isc::Exception::what ( bool  verbose) const
throw (
)
virtual

Returns a C-style character string of the cause of exception.

With verbose set to true, also returns file name and line numbers. Note that we can't simply define a single what() method with parameters, as the compiler would complain that it shadows the base class method.

Parameters
verboseif set to true, filename and line number will be added.
Returns
A C-style character string of the exception cause.

Definition at line 37 of file exceptions/exceptions.cc.


The documentation for this class was generated from the following files: