Kea 2.5.7
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

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.
 
virtual const char * what (bool verbose) const throw ()
 Returns a C-style character string of the cause of exception.
 

Getter Methods

const std::string & getMessage () const
 Gets a string describing the cause of the exception.
 
const char * getFile () const
 Gets the file name where the exception was thrown.
 
size_t getLine () const
 Gets the line number of the file where the exception was thrown.
 

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.
 
 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.
 
virtual ~Exception () throw ()
 The destructor.
 

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.

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.

◆ 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.

References what().

Referenced by isc::dns::rdata::generic::Generic::Generic(), isc::cryptolink::HashImpl::HashImpl(), isc::cryptolink::HMACImpl::HMACImpl(), isc::dhcp::IfaceMgr::IfaceMgr(), isc::dns::TSIGKey::TSIGKey(), isc::dns::rdata::generic::detail::TXTLikeImpl< Type, typeCode >::TXTLikeImpl(), isc::util::StateSet::add(), isc::asiolink::IOSignalSetImpl::add(), isc::dhcp::RelayInfoParser::addAddress(), isc::perfmon::AlarmStore::addAlarm(), isc::d2::NameChangeTransaction::addDhcidRdata(), isc::perfmon::MonitoredDurationStore::addDuration(), 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::tcp::TcpConnection::asyncAccept(), 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::agent::CtrlAgentProcess::configure(), isc::asiolink::TlsContextBase::configure(), isc::dhcp::configureDhcp4Server(), isc::dhcp::configureDhcp6Server(), isc::process::DControllerBase::configWriteHandler(), isc::dhcp::PgSqlLease4Exchange::convertFromDatabase(), isc::dhcp::PgSqlLease6Exchange::convertFromDatabase(), isc::http::HttpRequest::create(), isc::http::HttpResponse::create(), isc::dhcp::CfgOption::createDescriptorOption(), isc::dhcp::CfgDbAccess::createManagers(), isc::dhcp::OptionDataParser::createOption(), isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::createPacketQueue(), isc::dns::rdata::createRdata(), isc::dhcp::SubnetConfigParser::createSubnet(), isc::process::CBControlBase< ConfigBackendMgrType >::databaseConfigConnect(), isc::dhcp::Dhcpv4Srv::declineLease(), isc::dhcp::Dhcpv6Srv::declineLease(), isc::util::StateModel::defineEvent(), isc::util::StateModel::defineState(), isc::yang::Translator::deleteItem(), isc::http::HttpConnection::doHandshake(), isc::tcp::TcpConnection::doHandshake(), isc::config::CmdsImpl::extractCommand(), isc::dhcp::OptionDataParser::extractSpace(), isc::cryptolink::HashImpl::final(), isc::dhcp_ddns::NameChangeRequest::fromFormat(), isc::dhcp_ddns::NameChangeRequest::fromJSON(), isc::dhcp_ddns::D2Dhcid::fromStr(), isc::data::SimpleParser::getAddress(), isc::yang::TranslatorClass::getClass(), isc::yang::TranslatorClasses::getClasses(), isc::yang::TranslatorConfig::getConfig(), isc::yang::TranslatorControlSocket::getControlSocket(), isc::yang::Translator::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::yang::Translator::getItem(), isc::http::PostHttpRequestJson::getJsonElement(), isc::http::HttpResponseJson::getJsonElement(), isc::dhcp::OptionDataTypeUtil::getLabelCount(), isc::yang::Translator::getList(), 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::yang::TranslatorPool::getPool(), isc::yang::TranslatorPools::getPools(), isc::yang::TranslatorSharedNetwork::getSharedNetwork(), isc::yang::TranslatorSubnet::getSubnet(), isc::yang::TranslatorSubnets::getSubnets(), isc::agent::CtrlAgentCommandMgr::handleCommand(), isc::util::StateModel::initDictionaries(), isc::process::DControllerBase::initProcess(), isc::netconf::NetconfAgent::initSysrepo(), isc::dhcp_ddns::NameChangeListener::invokeRecvHandler(), isc::lfc::LFCController::launch(), isc::process::DControllerBase::launch(), isc::lease_cmds::LeaseCmdsImpl::lease4UpdateHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6BulkApplyHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6UpdateHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler(), 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::MySqlConnection::openDatabase(), isc::dhcp::IfaceMgr::openSocketFromRemoteAddress(), isc::dhcp::IfaceMgr::openSockets4(), isc::dhcp::IfaceMgr::openSockets6(), isc::d2::DNSClientImpl::operator()(), isc::dhcp::OptionDefinition::optionFactory(), isc::dhcp::Pkt4::pack(), isc::perfdhcp::PktTransform::pack(), isc::dhcp::Pkt6::packUDP(), isc::dhcp::MACSourcesListConfigParser::parse(), isc::dhcp::OptionDefListParser::parse(), isc::dhcp::SharedNetworksListParser< SharedNetworkParserType >::parse(), isc::dhcp::ClientClassDefParser::parse(), isc::dhcp::DUIDConfigParser::parse(), isc::dhcp::IfacesConfigParser::parse(), isc::ha::HAConfigParser::parse(), isc::process::ConfigControlParser::parse(), isc::dhcp::SharedNetwork4Parser::parse(), isc::dhcp::SharedNetwork6Parser::parse(), isc::http::BasicHttpAuthConfig::parse(), isc::netconf::ControlSocketConfigParser::parse(), isc::d2::TSIGKeyInfoParser::parse(), isc::netconf::ServerConfigParser::parse(), isc::dhcp::ExpressionParser::parse(), isc::agent::CtrlAgentCfgMgr::parse(), isc::d2::D2CfgMgr::parse(), isc::netconf::NetconfCfgMgr::parse(), isc::dhcp::D2ClientConfigParser::parse(), isc::dhcp::ExpirationConfigParser::parse(), isc::dhcp::OptionDefParser::parse(), isc::dhcp::SubnetConfigParser::parse(), isc::dhcp::PdPoolParser::parse(), isc::dhcp::PoolParser::parse(), isc::dhcp::Subnets4ListConfigParser::parse(), isc::dhcp::Subnets6ListConfigParser::parse(), isc::http::PostHttpRequestJson::parseBodyAsJson(), isc::http::HttpResponseJson::parseBodyAsJson(), isc::dhcp::HostReservationParser::parseInternal(), 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::hooks::LibraryManager::prepareUnloadLibrary(), isc::d2::NameChangeTransaction::prepNewRequest(), isc::dhcp::Dhcpv4Srv::processClientName(), isc::config::BaseCommandMgr::processCommand(), isc::dhcp::ControlledDhcpv4Srv::processCommand(), isc::dhcp::ControlledDhcpv6Srv::processCommand(), isc::dhcp::processDhcp4Config(), isc::dhcp::processDhcp6Config(), isc::dhcp::Dhcpv4Srv::processLocalizedQuery4(), isc::dhcp::Dhcpv4Srv::processPacket(), isc::dhcp::Dhcpv6Srv::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::dhcp::AllocEngine::renewLeases6(), isc::dhcp::Dhcpv6Srv::requiredClassify(), isc::dhcp::Dhcpv4Srv::requiredClassify(), isc::d2::D2CfgMgr::reverseIpAddress(), isc::agent::CtrlAgentProcess::run(), isc::d2::D2Process::run(), isc::netconf::NetconfProcess::run(), isc::util::unittests::run_all(), isc::hooks::LibraryManager::runLoad(), isc::dhcp::Dhcpv6Srv::sanityCheck(), 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::setConflictResolutionMode(), 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::Translator::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::yang::TranslatorSharedNetwork::setSharedNetwork(), isc::yang::TranslatorSharedNetworks::setSharedNetworks(), isc::yang::TranslatorSubnet::setSubnet(), isc::yang::TranslatorSubnets::setSubnets(), isc::cryptolink::HMACImpl::sign(), isc::config::CmdHttpListener::start(), isc::http::HttpListenerImpl::start(), isc::tcp::MtTcpListenerMgr::start(), isc::tcp::TcpListener::start(), isc::d2::D2QueueMgr::startListening(), isc::dhcp_ddns::NameChangeListener::startListening(), isc::dhcp_ddns::NameChangeSender::startSending(), isc::dhcp_ddns::NameChangeListener::stopListening(), isc::dhcp_ddns::NameChangeSender::stopSending(), isc::dhcp::ClientClassDef::test(), isc::dhcp::TemplateClientClassDef::test(), isc::config::JSONFeed::toElement(), isc::dhcp_ddns::NameChangeRequest::translateUseConflictResolution(), isc::perfdhcp::PktTransform::unpack(), isc::dhcp::DnrInstance::unpackAddresses(), isc::dhcp::Option6Dnr::unpackAddresses(), isc::dhcp::DnrInstance::unpackAdn(), isc::dhcp::DnrInstance::unpackSvcParams(), isc::cryptolink::HashImpl::update(), isc::cryptolink::HMACImpl::update(), isc::ha::HAConfig::validate(), isc::cryptolink::HMACImpl::verify(), what(), isc::dhcp::OptionDataTypeUtil::writeBinary(), and isc::dhcp::OptionDataTypeUtil::writeFqdn().

+ Here is the call graph for this function:

◆ 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: