Kea: Exception Class Reference

| Kea 3.2.0-git

Exception Class Reference

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

`#include <exceptions.h>`

Inheritance diagram for Exception:
[legend]

## 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

  file | the file name where the exception was thrown.
  line | the line in file where the exception was thrown.
  what | a 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

  file | the file name where the exception was thrown.
  line | the line in file where the exception was thrown.
  what | a 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.

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

  verbose | if 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:

- exceptions/exceptions.h
- exceptions/exceptions.cc