51 return "Sorry, Lumiera encountered an internal error.";
58 return isnil (detailinfo)?
"Lumiera errorstate detected"
105 , cause_{extractCauseMsg(cause)}
107 string detailInfo{description + (
isnil(cause_)?
"" :
" | cause = "+cause_)};
121 if (isnil (this->
what_))
127 return what_.c_str();
140 if (isnil (
err->cause_))
146 return cause.what ();
170 =
"### Lumiera halted due to an unexpected Error ###";
172 ERROR (NOBUG_ON,
"%s", is_halted);
173 std::cerr <<
"\n" << is_halted <<
"\n\n";
177 auto lastException = std::current_exception();
179 std::rethrow_exception (lastException);
182 std::cout <<
"\n+++ Caught Exception " << lerr.
getID() <<
"\n\n";
183 ERROR (NOBUG_ON,
"+++ caught %s\n+++ messg: %s\n+++ descr: %s"
184 ,
cStr(util::typeStr(lerr))
191 }
catch(
const std::exception& e) {
192 ERROR (NOBUG_ON,
"Generic Exception: %s", e.what());
193 std::cout <<
"+++ Caught Exception \"" << e.what() <<
"\"\n";
195 ERROR (NOBUG_ON,
"FATAL -- unknown exception");
199 ERROR (NOBUG_ON,
"last registered error was....\n%s", errorstate);
210 throw Fatal (location, LUMIERA_ERROR_ASSERTION)
211 .setUsermsg(
"Program terminated because of violating "
212 "an internal consistency check.");
Interface and Base definition for all Lumiera Exceptions.
const string cause_
description of first exception encountered in the chain
string const & getUsermsg() const noexcept
extract the message to be displayed for the user
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
string desc_
detailed description of the error situation for the developers
static const string extractCauseMsg(std::exception const &) noexcept
lumiera_err const id_
an LUMIERA_ERROR id, which is set as errorstate on construction
lumiera_err getID() const noexcept
the internal Lumiera-error-ID (was set as C-errorstate in ctor)
string const & rootCause() const noexcept
If this exception was caused by a chain of further exceptions, return the description of the first on...
string what_
buffer for generating the detailed description on demand
define and register a callback for a specific lifecycle event.
const char * lumiera_error_extra(void)
Query the extra context for the last error.
lumiera_err lumiera_error(void)
Get and clear current error state.
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.
Lumiera error handling (C++ interface).
Installing and invoking of application lifecycle event callbacks.
std::terminate_handler nextHandler
void assertion_terminate(const string &location)
throw an error::Fatal indicating "assertion failure"
void lumiera_unexpectedException() noexcept
global function for handling unknown exceptions encountered at functions declaring not to throw this ...
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.
LumieraError< LERR_(FATAL), Logic > Fatal
Lumiera public interface.
CStr ON_BASIC_INIT
automatic static init. treated specially to run as soon as possible
bool isnil(lib::time::Duration const &dur)
CStr cStr(std::string const &rendered)
convenience shortcut: forced conversion to c-String via string.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...