30 using std::runtime_error;
66 catcher (&test::throwDerived,
"test-1");
67 catcher (&test::throwFatal,
"test-2");
68 catcher (&test::throwInvalid,
"test-3");
69 catcher (&test::throwExternal,
"test-4");
70 catcher (&test::throwRuntime,
"test-5");
71 catcher (&test::throwExceptn,
"test-6");
88 void throwRuntime (
string _) {
throw std::runtime_error(_); }
89 void throwExceptn (
string ) {
throw std::exception(); }
103 try { throwExternal(msg); }
104 catch (std::exception& e)
106 cout <<
"intermediate handler caught: " << e.what()
107 <<
"....will rethrow as error::State\n";
118 cout <<
"2nd intermediate handler caught: " << e.
what()
119 <<
"....will rethrow as error::Config\n";
136 catcher (&test::detectErrorflag);
151 std::runtime_error rerr(
"what a shame");
155 CHECK (err2.rootCause() == err1.what());
156 CHECK (err3.rootCause() == err1.what());
157 CHECK (err4.
rootCause() == err1.rootCause());
159 CHECK (err5.rootCause() == rerr.what());
194 (this->*funky) (context);
197 catch (
SpecificError& e) { cout <<
"caught: " << e.what() <<
"..the answer is: " << e.revealIt() <<
"\n"; }
198 catch (
error::Logic& e) { cout <<
"caught error::Logic: " << e.what() <<
"\n"; }
199 catch (
error::Invalid&e) { cout <<
"caught error::Invalid: " << e.what() <<
"\n"; }
200 catch (
Error& e) { cout <<
"caught lumiera::Error: " << e.
what() <<
"\n"; }
201 catch (runtime_error& e) { cout <<
"caught std::runtime_error: " << e.what() <<
"\n"; }
202 catch (exception& e) { cout <<
"caught std::exception. (unspecific)" <<
"\n"; }
203 catch (...) { cout <<
"caught an unknown exception\n"; }
lumiera_err lumiera_error_peek(void)
Check current error state without clearing it Please avoid this function and use lumiera_error() if p...
void nestedThrower(string msg)
virtual CStr what() const noexcept override
std::exception interface : yield a diagnostic message
void catcher(void(ExceptionError_test::*funky)(string), string context="")
helper: provides a bunch of catch-clauses and runs the given member functions within ...
void throwOnError()
Check the lumiera error state, which maybe was set by C-code.
void checkErrorFlagPropagation()
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Some aspects of C++ exception handling.
Lumiera error handling (C interface).
Derived specific exceptions within Lumiera's exception hierarchy.
void throwSpecial(string)
void checkRootCauseChaining()
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
string const & rootCause() const noexcept
If this exception was caused by a chain of further exceptions, return the description of the first on...
Lumiera error handling (C++ interface).
lumiera_err lumiera_error_set(lumiera_err nerr, const char *extra)
Set error state for the current thread.
void doubleNestedTh(string msg)
Lumiera public interface.
a very specific Exception class local to this scope and with additional behaviour.
Interface and Base definition for all Lumiera Exceptions.
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.