Lumiera  0.pre.03
»edit your freedom«
Error Class Reference

#include "lib/error.hpp"

Description

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.

Definition at line 71 of file error.hpp.

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
 
Erroroperator= (Error &&)=delete
 
Erroroperator= (Error const &)=delete
 
ErrorprependInfo (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...
 
ErrorsetUsermsg (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
 

Member Function Documentation

◆ what()

CStr what ( ) const
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 128 of file error-exception.cpp.

Referenced by AppState::abort(), OutputDirector::bringDown(), ExceptionError_test::catcher(), ExceptionError_test::doubleNestedTh(), HandlingPattern::invoke(), lumiera::error::lumiera_unexpectedException(), and AllocationCluster::~AllocationCluster().

+ Here is the caller graph for this function:

◆ rootCause()

string const& rootCause ( ) const
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

Returns
the description string, maybe empty (if there is no known root cause)

Definition at line 122 of file error.hpp.

Referenced by ExceptionError_test::checkRootCauseChaining().

+ Here is the caller graph for this function:

◆ setUsermsg()

Error& setUsermsg ( string const &  newMsg)
inlinenoexcept

replace the previous or default friendly message for the user.

Note
to be localised / translated.

Definition at line 131 of file error.hpp.

◆ prependInfo()

Error& prependInfo ( string const &  text)
inlinenoexcept

give additional developer info.

Typically used at intermediate handlers to add context.

Definition at line 139 of file error.hpp.

References LUMIERA_ERROR_DECLARE.

◆ extractCauseMsg()

const string extractCauseMsg ( std::exception const &  cause)
staticprivatenoexcept

get at the description message of the first exception encountered in a chain of exceptions

Definition at line 144 of file error-exception.cpp.

+ Inheritance diagram for Error:
+ Collaboration diagram for Error:

The documentation for this class was generated from the following files: