class
#include <src/Base/Exception.hpp>
Exception Basic exception class for producing file:func:line info + call trace.
The basic functionality provided by the Exception class is to facilitate printing out a message, together with the location of the exception (file, line, funcion name), as well as a call trace if available, when an exception is thrown.
Constructors, destructors, conversion operators
- Exception(std::string&& message, std::string&& file = "", std::string&& function = "", unsigned int line = 0) explicit noexcept
- Constructor.
- ~Exception() override noexcept
- Destructor.
- Exception(Exception&&) defaulted
- Force move constructor for throws.
Public functions
- auto what() const -> const char* override noexcept
- auto handleException() -> ErrCode virtual noexcept
- Handle Exception.
- auto func() const -> const std::string& noexcept
Function documentation
tk:: Exception:: Exception(std::string&& message,
std::string&& file = "",
std::string&& function = "",
unsigned int line = 0) explicit noexcept
Constructor.
Parameters | |
---|---|
message in | String (moved from) with an error message |
file in | String (moved from) with the file name in which the exception ocurred |
function in | String (moved from) containing the name of the function in which the exception ocurred |
line in | Source code line number at which the exception ocurred |
While throwing exceptions is possible calling this constructor, the easiest and recommend way is to use the Assert, ErrChk, and Throw macros. Exception safety: no-throw guarantee: this member function never throws exceptions.
tk:: Exception:: ~Exception() override noexcept
Destructor.
Exception safety: no-throw guarantee: this member function never throws exceptions.
ErrCode tk:: Exception:: handleException() virtual noexcept
Handle Exception.
Returns | Error code, as defined in stdlib.h, i.e., cstdlib |
---|
Exception safety: no-throw guarantee: this member function never throws exceptions.
const std::string& tk:: Exception:: func() const noexcept
Returns | Reference to function name in which the exception occurred |
---|
Accessor to function name