60 return "Sorry, Lumiera encountered an internal error.";
67 return isnil (detailinfo)?
"Lumiera errorstate detected" 102 , msg_{error::default_usermsg (
this)}
109 string description, lumiera_err
const id) noexcept
112 , msg_{error::default_usermsg (
this)}
114 , cause_{extractCauseMsg(cause)}
116 string detailInfo{description + (isnil(cause_)?
"" :
" | cause = "+cause_)};
130 if (isnil (this->what_))
133 if (!isnil (desc_)) what_ +=
" ("+desc_+
").";
134 if (!isnil (cause_)) what_ += string(
" -- caused by: ") + cause_;
136 return what_.c_str();
155 return cause.what ();
172 std::terminate_handler nextHandler =
nullptr;
179 =
"### Lumiera halted due to an unexpected Error ###";
181 ERROR (NOBUG_ON,
"%s", is_halted);
182 std::cerr <<
"\n" << is_halted <<
"\n\n";
186 auto lastException = std::current_exception();
188 std::rethrow_exception (lastException);
191 std::cout <<
"\n+++ Caught Exception " << lerr.
getID() <<
"\n\n";
192 ERROR (NOBUG_ON,
"+++ caught %s\n+++ messg: %s\n+++ descr: %s" 193 ,
cStr(util::typeStr(lerr))
200 }
catch(
const std::exception& e) {
201 ERROR (NOBUG_ON,
"Generic Exception: %s", e.what());
202 std::cout <<
"+++ Caught Exception \"" << e.what() <<
"\"\n";
204 ERROR (NOBUG_ON,
"FATAL -- unknown exception");
208 ERROR (NOBUG_ON,
"last registered error was....\n%s", errorstate);
219 throw Fatal (location, LUMIERA_ERROR_ASSERTION)
220 .setUsermsg(
"Program terminated because of violating " 221 "an internal consistency check.");
void assertion_terminate(const string &location)
throw an error::Fatal indicating "assertion failure"
const char * ON_BASIC_INIT
automatic static init. treated specially to run as soon as possible
Installing and invoking of application lifecycle event callbacks.
lumiera_err getID() const noexcept
the internal Lumiera-error-ID (was set as C-errorstate in ctor)
CStr cStr(std::string const &rendered)
convenience shortcut: forced conversion to c-String via string.
virtual CStr what() const noexcept override
std::exception interface : yield a diagnostic message
Error(string description="", lumiera_err const id=LERR_(EXCEPTION)) noexcept
this is an interface
Derived specific exceptions within Lumiera's exception hierarchy.
static const string extractCauseMsg(std::exception const &) noexcept
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
lumiera_err lumiera_error(void)
Get and clear current error state.
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 on...
const string cause_
description of first exception encountered in the chain
define and register a callback for a specific lifecycle event.
Lumiera error handling (C++ interface).
Lumiera public interface.
void install_unexpectedException_handler()
install our own handler for undeclared exceptions.
const string default_usermsg(Error *) noexcept
the message shown to the user per default if an exception reaches one of the top-level catch clauses...
void lumiera_unexpectedException() noexcept
global function for handling unknown exceptions encountered at functions declaring not to throw this ...
const char * lumiera_error_extra(void)
Query the extra context for the last error.
Interface and Base definition for all Lumiera Exceptions.
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.