51 return "Sorry, Lumiera encountered an internal error.";
58 return isnil (detailinfo)?
"Lumiera errorstate detected" 93 , msg_{error::default_usermsg (
this)}
100 string description, lumiera_err
const id) noexcept
103 , msg_{error::default_usermsg (
this)}
105 , cause_{extractCauseMsg(cause)}
107 string detailInfo{description + (isnil(cause_)?
"" :
" | cause = "+cause_)};
121 if (isnil (this->what_))
124 if (!isnil (desc_)) what_ +=
" ("+desc_+
").";
125 if (!isnil (cause_)) what_ += string(
" -- caused by: ") + cause_;
127 return what_.c_str();
146 return cause.what ();
163 std::terminate_handler nextHandler =
nullptr;
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.");
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.