Pure virtual class parent of all webdar exceptions. More...
#include <exceptions.hpp>
Inherited by libthreadar::exception_bug, libthreadar::exception_feature, libthreadar::exception_memory, libthreadar::exception_range, libthreadar::exception_system, and libthreadar::exception_thread.
Public Member Functions | |
exception_base (const std::string &x_msg) | |
constructor More... | |
virtual | ~exception_base () |
destructor | |
void | push_message (const std::string &x_msg) |
to be used in a catch clause to add context information before rethrowing the exception | |
unsigned int | size () const |
for site which need to display the information to the user More... | |
const std::string & | operator[] (unsigned int i) const |
for site which need to display the information to the user More... | |
std::string | get_message (const std::string &sep) const |
concatenated messages and use the given separator between messages More... | |
virtual exception_base * | clone () const =0 |
create a new object of the same type and value of the object which clone() method is invoked More... | |
Protected Member Functions | |
void | reset_first_message (const std::string &msg) |
for libthreader internal use only | |
Pure virtual class parent of all webdar exceptions.
Over the different classes inherited from exception_base, all libthreadar exceptions contain a list of message that start from the source of the error followed by messages added by each try/catch context it occured in. You can access these messages by two ways:
You may ignore other features relative to exceptions used by libthreadar to report error while still able to completely use libthreadar.
However you are allowed to add new messages to the stack using push_message() and then rethrow the exception for propagation.
Why not concatenating string at each catch clause and propagating the exception? because depending on languagues some may prefer to present this nested informations another way than separating them with ':' from the less specific to the root cause
Definition at line 79 of file exceptions.hpp.
|
inline |
|
pure virtual |
create a new object of the same type and value of the object which clone() method is invoked
Implemented in libthreadar::exception_feature, libthreadar::exception_range, libthreadar::exception_system, libthreadar::exception_thread, libthreadar::exception_bug, and libthreadar::exception_memory.
std::string libthreadar::exception_base::get_message | ( | const std::string & | sep | ) | const |
concatenated messages and use the given separator between messages
[in] | sep | is a string to insert between messages of the list (like for example ": ") |
|
inline |
for site which need to display the information to the user
[in] | i | is the index of the element of the list to return, it must be stricly lesser than size() |
Definition at line 102 of file exceptions.hpp.
|
inline |
for site which need to display the information to the user
Definition at line 96 of file exceptions.hpp.