39 using std::runtime_error;
75 catcher (&test::throwDerived,
"test-1");
76 catcher (&test::throwFatal,
"test-2");
77 catcher (&test::throwInvalid,
"test-3");
78 catcher (&test::throwExternal,
"test-4");
79 catcher (&test::throwRuntime,
"test-5");
80 catcher (&test::throwExceptn,
"test-6");
97 void throwRuntime (
string _) {
throw std::runtime_error(_); }
98 void throwExceptn (
string ) {
throw std::exception(); }
112 try { throwExternal(msg); }
113 catch (std::exception& e)
115 cout <<
"intermediate handler caught: " << e.what()
116 <<
"....will rethrow as error::State\n";
127 cout <<
"2nd intermediate handler caught: " << e.
what()
128 <<
"....will rethrow as error::Config\n";
145 catcher (&test::detectErrorflag);
160 std::runtime_error rerr(
"what a shame");
164 CHECK (err2.rootCause() == err1.what());
165 CHECK (err3.rootCause() == err1.what());
166 CHECK (err4.
rootCause() == err1.rootCause());
168 CHECK (err5.rootCause() == rerr.what());
203 (this->*funky) (context);
206 catch (
SpecificError& e) { cout <<
"caught: " << e.what() <<
"..the answer is: " << e.revealIt() <<
"\n"; }
207 catch (
error::Logic& e) { cout <<
"caught error::Logic: " << e.what() <<
"\n"; }
208 catch (
error::Invalid&e) { cout <<
"caught error::Invalid: " << e.what() <<
"\n"; }
209 catch (
Error& e) { cout <<
"caught lumiera::Error: " << e.
what() <<
"\n"; }
210 catch (runtime_error& e) { cout <<
"caught std::runtime_error: " << e.what() <<
"\n"; }
211 catch (exception& e) { cout <<
"caught std::exception. (unspecific)" <<
"\n"; }
212 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()
Simple 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.