class intended for the use in throw statements
More...
class intended for the use in throw statements
The objects of this class store a message (that describes the error when thrown) that can then be displayed in a catch
block
try{
throw Error(Message(
_ping_)<<
"This is error number "<<number);}
catch(
Error& m) {std::cerr << m.what();}
Error(const Message &message)
Constructor.
Definition: exceptions.h:92
#define _ping_
Definition: exceptions.h:12
◆ Error()
dg::Error::Error |
( |
const Message & |
message | ) |
|
|
inline |
Constructor.
- Parameters
-
message | An instance of a Message class |
◆ ~Error()
virtual dg::Error::~Error |
( |
| ) |
|
throw | ( | |
| ) | | |
|
inlinevirtual |
◆ append()
void dg::Error::append |
( |
const Message & |
message | ) |
|
|
inline |
Appends a message verbatim to the what string.
- Parameters
-
◆ append_line()
void dg::Error::append_line |
( |
const Message & |
message | ) |
|
|
inline |
Appends a newline and a message verbatim to the what string.
- Parameters
-
message | message to append after newline |
◆ get_message()
std::string dg::Error::get_message |
( |
| ) |
const |
|
inline |
◆ what()
virtual const char * dg::Error::what |
( |
| ) |
const |
throw | ( | |
| ) | | |
|
inlinevirtual |
- Returns
- file, line and the message given in the constructor as a string of char
The documentation for this class was generated from the following file: