Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
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 63 of file error.hpp.

Public Member Functions

virtual ~Error () noexcept
 
 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
 
Erroroperator= (Error &&)=delete
 
Erroroperator= (Error const &)=delete
 
virtual CStr what () const noexcept override
 std::exception interface : yield a diagnostic message
 
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
 
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.
 
ErrorsetUsermsg (string const &newMsg) noexcept
 replace the previous or default friendly message for the user.
 
ErrorprependInfo (string const &text) noexcept
 give additional developer info.
 

Static Private Member Functions

static const string extractCauseMsg (std::exception const &) noexcept
 

Private Attributes

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 desc_
 detailed description of the error situation for the developers
 
string what_
 buffer for generating the detailed description on demand
 
const string cause_
 description of first exception encountered in the chain
 

Constructor & Destructor Documentation

◆ ~Error()

virtual ~Error ( )
inlinevirtualnoexcept

Definition at line 74 of file error.hpp.

◆ Error() [1/4]

Error ( string  description = "",
lumiera_err const  id = LERR_(EXCEPTION) 
)
noexcept

this is an interface

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

◆ Error() [2/4]

Error ( std::exception const &  cause,
string  description = "",
lumiera_err const  id = LERR_(EXCEPTION) 
)
noexcept

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

◆ Error() [3/4]

Error ( Error &&  )
default

◆ Error() [4/4]

Error ( Error const &  )
default

Member Function Documentation

◆ operator=() [1/2]

Error & operator= ( Error &&  )
delete

◆ operator=() [2/2]

Error & operator= ( Error const &  )
delete

◆ 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 119 of file error-exception.cpp.

References Error::cause_, Error::desc_, Error::id_, and Error::what_.

Referenced by AppState::abort(), OutputDirector::bringDown(), ExceptionError_test::catcher(), ExceptionError_test::doubleNestedTh(), Error::extractCauseMsg(), test::anonymous_namespace{suite.cpp}::invokeTestCase(), lumiera::error::lumiera_unexpectedException(), GtkLumiera::run(), ZombieCheck_test::run(), and MockSys::run().

+ Here is the caller graph for this function:

◆ getID()

lumiera_err getID ( ) const
inlinenoexcept

the internal Lumiera-error-ID (was set as C-errorstate in ctor)

Definition at line 95 of file error.hpp.

References Error::id_.

Referenced by lumiera::error::lumiera_unexpectedException().

+ Here is the caller graph for this function:

◆ getUsermsg()

string const & getUsermsg ( ) const
inlinenoexcept

extract the message to be displayed for the user

Definition at line 102 of file error.hpp.

References Error::msg_.

Referenced by lumiera::error::lumiera_unexpectedException().

+ 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 114 of file error.hpp.

References Error::cause_.

Referenced by ExceptionError_test::checkRootCauseChaining(), and lumiera::error::lumiera_unexpectedException().

+ 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 123 of file error.hpp.

References Error::msg_.

◆ prependInfo()

Error & prependInfo ( string const &  text)
inlinenoexcept

give additional developer info.

Typically used at intermediate handlers to add context.

Definition at line 131 of file error.hpp.

References Error::desc_.

◆ 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 135 of file error-exception.cpp.

References Error::what().

+ Here is the call graph for this function:

Member Data Documentation

◆ id_

lumiera_err const id_
private

an LUMIERA_ERROR id, which is set as errorstate on construction

Definition at line 66 of file error.hpp.

Referenced by Error::getID(), and Error::what().

◆ msg_

string msg_
private

friendly message intended for users (to be localised)

Definition at line 67 of file error.hpp.

Referenced by Error::getUsermsg(), and Error::setUsermsg().

◆ desc_

string desc_
private

detailed description of the error situation for the developers

Definition at line 68 of file error.hpp.

Referenced by Error::prependInfo(), and Error::what().

◆ what_

string what_
mutableprivate

buffer for generating the detailed description on demand

Definition at line 69 of file error.hpp.

Referenced by Error::what().

◆ cause_

const string cause_
private

description of first exception encountered in the chain

Definition at line 70 of file error.hpp.

Referenced by Error::rootCause(), and Error::what().

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

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