Kea 2.7.5
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.

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

◆ 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::config::HttpCommandConfig::HttpCommandConfig(), isc::dhcp::IfaceMgr::IfaceMgr(), isc::dhcp::TokenMatch::TokenMatch(), isc::dns::TSIGKey::TSIGKey(), 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::log::Formatter< Logger >::arg(), isc::http::HttpConnection::asyncAccept(), isc::tcp::TcpConnection::asyncAccept(), isc::process::DControllerBase::checkConfigOnly(), isc::perfmon::PerfMonMgr::configure(), isc::agent::CtrlAgentProcess::configure(), isc::asiolink::TlsContextBase::configure(), isc::http::HttpRequest::create(), isc::http::HttpResponse::create(), isc::dhcp::OptionDataParser::createOption(), isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::createPacketQueue(), isc::dhcp::SubnetConfigParser::createSubnet(), 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::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::Translator::getData(), isc::yang::TranslatorDatabase::getDatabase(), isc::yang::TranslatorDatabases::getDatabases(), isc::http::BasicHttpAuthConfig::getFileContent(), isc::http::HttpMessage::getHeaderValueAsUint64(), isc::yang::TranslatorHost::getHost(), isc::yang::Translator::getItem(), isc::http::PostHttpRequestJson::getJsonElement(), isc::http::HttpResponseJson::getJsonElement(), isc::dhcp::OptionDataTypeUtil::getLabelCount(), isc::yang::TranslatorLogger::getLogger(), isc::yang::TranslatorLoggers::getLoggers(), isc::perfmon::DurationKeyParser::getMessageType(), 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::util::StateModel::initDictionaries(), isc::process::DControllerBase::initProcess(), isc::netconf::NetconfAgent::initSysrepo(), isc::process::DControllerBase::launch(), isc::dhcp::ControlledDhcpv4Srv::loadConfigFile(), isc::dhcp::ControlledDhcpv6Srv::loadConfigFile(), user_chk::UserFile::makeUser(), isc::config::UnixCommandMgrImpl::openCommandSocket(), isc::db::MySqlConnection::openDatabase(), isc::dhcp::IfaceMgr::openSocketFromRemoteAddress(), isc::dhcp::IfaceMgr::openSockets4(), isc::dhcp::IfaceMgr::openSockets6(), isc::dhcp::OptionDefinition::optionFactory(), isc::dhcp::Pkt4::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::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::dhcp::Subnets4ListConfigParser::parse(), isc::dhcp::Subnets6ListConfigParser::parse(), isc::perfmon::PerfMonConfig::parseAlarms(), 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::d2::NameChangeTransaction::prepNewRequest(), isc::util::CSVRow::readAndConvertAt(), isc::dhcp::OptionDataTypeUtil::readFqdn(), isc::dhcp::OptionDataTypeUtil::readPrefix(), isc::dhcp::OptionDataTypeUtil::readTuple(), isc::util::CSVFile::recreate(), user_chk::UserRegistry::refresh(), isc::asiolink::IOSignalSetImpl::remove(), isc::d2::D2CfgMgr::reverseIpAddress(), isc::agent::CtrlAgentProcess::run(), isc::d2::D2Process::run(), isc::netconf::NetconfProcess::run(), 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::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::cryptolink::HMACImpl::sign(), 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::config::JSONFeed::toElement(), isc::dhcp_ddns::NameChangeRequest::translateUseConflictResolution(), isc::dhcp::LibDHCP::unpackOptions4(), isc::dhcp::LibDHCP::unpackOptions6(), 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: