Kea 2.7.6
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::dns::TSIGKey::TSIGKey(), isc::dns::rdata::generic::detail::TXTLikeImpl< Type, typeCode >::TXTLikeImpl(), isc::asiolink::IOSignalSetImpl::add(), isc::dhcp::AllocEngine::allocateLease4(), isc::dhcp::AllocEngine::allocateLeases6(), isc::log::Formatter< Logger >::arg(), isc::dhcp::Dhcpv4Srv::assignLease(), buffer4_receive(), isc::ha::HAImpl::buffer4Receive(), isc::ha::HAImpl::buffer6Receive(), isc::http::BasicHttpAuthConfig::checkAuth(), isc::ha::HAService::checkPermissionsClientAndListener(), isc::d2::D2Process::checkQueueStatus(), isc::agent::CtrlAgentProcess::configure(), isc::dhcp::configureDhcp4Server(), isc::dhcp::configureDhcp6Server(), isc::process::DControllerBase::configWriteHandler(), isc::dhcp::CfgDbAccess::createManagers(), isc::dhcp::OptionDataParser::createOption(), isc::dns::rdata::createRdata(), isc::dhcp::SubnetConfigParser::createSubnet(), isc::process::CBControlBase< ConfigBackendMgrType >::databaseConfigConnect(), isc::dhcp::Dhcpv4Srv::declineLease(), isc::dhcp::Dhcpv6Srv::declineLease(), isc::dhcp::Dhcpv4Srv::evaluateAdditionalClasses(), isc::dhcp::Dhcpv6Srv::evaluateAdditionalClasses(), isc::cryptolink::HashImpl::final(), isc::cryptolink::HashImpl::final(), isc::cryptolink::HashImpl::final(), isc::dhcp_ddns::NameChangeRequest::fromFormat(), isc::dhcp_ddns::NameChangeRequest::fromJSON(), isc::dhcp_ddns::D2Dhcid::fromStr(), isc::yang::TranslatorClass::getClass(), isc::yang::TranslatorClasses::getClasses(), isc::yang::TranslatorConfig::getConfig(), isc::yang::TranslatorControlSocket::getControlSocket(), isc::yang::TranslatorDatabase::getDatabase(), isc::yang::TranslatorDatabases::getDatabases(), isc::http::BasicHttpAuthConfig::getFileContent(), isc::yang::TranslatorHost::getHost(), 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::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::dns::MasterLoader::MasterLoaderImpl::loadIncremental(), main(), user_chk::UserFile::makeUser(), isc::util::CSVFile::next(), 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::agent::CtrlAgentCfgMgr::parse(), isc::d2::D2CfgMgr::parse(), isc::dhcp::MACSourcesListConfigParser::parse(), isc::dhcp::OptionDefParser::parse(), isc::ha::HAConfigParser::parse(), isc::netconf::NetconfCfgMgr::parse(), isc::dhcp::Option4ClientFqdnImpl::parseWireData(), isc::dhcp::Dhcpv4Srv::postAllocateNameUpdate(), isc::hooks::LibraryManager::prepareUnloadLibrary(), isc::dhcp::Dhcpv4Srv::processClientName(), isc::config::BaseCommandMgr::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::asiolink::IOSignalSetImpl::remove(), isc::dhcp::AllocEngine::renewLeases6(), isc::d2::D2CfgMgr::reverseIpAddress(), isc::util::unittests::run_all(), isc::hooks::LibraryManager::runLoad(), isc::dhcp::Dhcpv6Srv::sanityCheck(), isc::dhcp_ddns::NameChangeRequest::setChangeType(), isc::yang::TranslatorClass::setClass(), isc::yang::TranslatorClasses::setClasses(), isc::yang::TranslatorConfig::setConfig(), isc::dhcp_ddns::NameChangeRequest::setConflictResolutionMode(), isc::yang::TranslatorDatabase::setDatabase(), isc::yang::TranslatorDatabases::setDatabases(), isc::dhcp_ddns::NameChangeRequest::setForwardChange(), isc::yang::TranslatorHost::setHost(), isc::yang::TranslatorHosts::setHosts(), 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::cryptolink::HMACImpl::sign(), isc::cryptolink::HMACImpl::sign(), isc::http::HttpListenerImpl::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::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: