LUMIERA.clone/tests/10exception.tests
Ichthyostega 9cb0a9b680 Library: discontinue setting error flag from Exceptions (see #1341)
While seemingly subtle, this is a ''deep change.''
Up to now, the project attempted to maintain two mutually disjoint
systems of error reporting: C-style error flags and C++ exceptions.
Most notably, an attempt was made to keep both error states synced.

During the recent integration efforts, this increasingly turned out
as an obstacle and source for insidious problems (like deadlocks).


As a resolve, hereby the relation of both systems is **clarified**:
 * C-style error flags shall only be set and used by C code henceforth
 * C++ exceptions can (optionally) be thrown by retrieving the C-style error code
 * but the opposite is now ''discontinued'' : Exceptions ''do not set'' the error flag anymore
2023-10-01 20:11:45 +02:00

22 lines
1.5 KiB
Text

TESTING "Exception handling and diagnostics" ./test-suite --group=common
TEST "Exceptions and Error flags" ExceptionError_test <<END
out: caught: LUMIERA_ERROR_LIFE_AND_UNIVERSE:and everything\? \(don't panic\)...the answer is: 42
out: caught lumiera::Error: LUMIERA_ERROR_DERIVED:convoluted exception
out: caught error::Logic: LUMIERA_ERROR_FATAL:floundered \(test-2\).
out: caught error::Invalid: LUMIERA_ERROR_INVALID:invalid input or parameters \(test-3\).
out: caught lumiera::Error: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-4\).
out: caught std::runtime_error: test-5
out: caught std::exception. \(unspecific\)
out: intermediate handler caught: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-7\).....will rethrow as error::State
out: caught lumiera::Error: LUMIERA_ERROR_STATE:unforeseen state -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-7\).
out: intermediate handler caught: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-8\).....will rethrow as error::State
out: 2nd intermediate handler caught: LUMIERA_ERROR_STATE:unforeseen state -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-8\).....will rethrow as error::Config
out: caught error::Invalid: LUMIERA_ERROR_CONFIG:misconfiguration -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-8\)\.
out: caught lumiera::Error: LUMIERA_ERROR_LIFE_AND_UNIVERSE:and everything\? \(what is the answer\?\)\.
return: 0
END