Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/error.hpp"
Interface and Base definition for all Lumiera Exceptions.
Provides common operations for getting a diagnostic message and to obtain the root cause message, i.e. the message from the first exception encountered in a chain of exceptions.
Public Member Functions | |
Error (string description="", lumiera_err const id=LERR_(EXCEPTION)) noexcept | |
this is an interface | |
Error (std::exception const &cause, string description="", lumiera_err const id=LERR_(EXCEPTION)) noexcept | |
Error (Error &&)=default | |
Error (Error const &)=default | |
lumiera_err | getID () const noexcept |
the internal Lumiera-error-ID (was set as C-errorstate in ctor) | |
string const & | getUsermsg () const noexcept |
extract the message to be displayed for the user | |
Error & | operator= (Error &&)=delete |
Error & | operator= (Error const &)=delete |
Error & | prependInfo (string const &text) noexcept |
give additional developer info. More... | |
string const & | rootCause () const noexcept |
If this exception was caused by a chain of further exceptions, return the description of the first one registered in this throw sequence. More... | |
Error & | setUsermsg (string const &newMsg) noexcept |
replace the previous or default friendly message for the user. More... | |
virtual CStr | what () const noexcept override |
std::exception interface : yield a diagnostic message More... | |
Static Private Member Functions | |
static const string | extractCauseMsg (std::exception const &) noexcept |
Private Attributes | |
const string | cause_ |
description of first exception encountered in the chain | |
string | desc_ |
detailed description of the error situation for the developers | |
lumiera_err const | id_ |
an LUMIERA_ERROR id, which is set as errorstate on construction | |
string | msg_ |
friendly message intended for users (to be localised) | |
string | what_ |
buffer for generating the detailed description on demand | |
|
overridevirtualnoexcept |
std::exception interface : yield a diagnostic message
Description of the problem, including the internal char constant in accordance to Lumiera's error identification scheme.
If a root cause can be obtained, this will be included in the generated output as well.
Definition at line 119 of file error-exception.cpp.
Referenced by AppState::abort(), OutputDirector::bringDown(), ExceptionError_test::catcher(), ExceptionError_test::doubleNestedTh(), HandlingPattern::invoke(), and lumiera::error::lumiera_unexpectedException().
|
inlinenoexcept |
If this exception was caused by a chain of further exceptions, return the description of the first one registered in this throw sequence.
This works only if every exceptions thrown as a consequence of another exception is properly constructed by passing the original exception to the constructor
Definition at line 113 of file error.hpp.
Referenced by ExceptionError_test::checkRootCauseChaining().
|
inlinenoexcept |
|
inlinenoexcept |
give additional developer info.
Typically used at intermediate handlers to add context.
Definition at line 130 of file error.hpp.
References LUMIERA_ERROR_DECLARE.
|
staticprivatenoexcept |
get at the description message of the first exception encountered in a chain of exceptions
Definition at line 135 of file error-exception.cpp.