diff --git a/src/lib/allocation-cluster.cpp b/src/lib/allocation-cluster.cpp index a6731aca1..865c74d02 100644 --- a/src/lib/allocation-cluster.cpp +++ b/src/lib/allocation-cluster.cpp @@ -213,6 +213,8 @@ namespace lib { catch (lumiera::Error & ex) { WARN (progress, "Exception while closing AllocationCluster: %s", ex.what()); + const char* errID = lumiera_error(); + TRACE (debugging, "Error flag was: %s", errID); } catch (...) { diff --git a/src/lib/error-exception.cpp b/src/lib/error-exception.cpp index 67b54a001..3320dcd06 100644 --- a/src/lib/error-exception.cpp +++ b/src/lib/error-exception.cpp @@ -96,16 +96,13 @@ namespace lumiera { - /** @note we set the C-style errorstate as a side effect */ Error::Error (string description, lumiera_err const id) noexcept : std::exception{} , id_{id} , msg_{error::default_usermsg (this)} , desc_{description} , cause_{} - { - lumiera_error_set (this->id_, description.c_str()); - } + { } Error::Error (std::exception const& cause, @@ -117,7 +114,6 @@ namespace lumiera { , cause_{extractCauseMsg(cause)} { string detailInfo{description + (isnil(cause_)? "" : " | cause = "+cause_)}; - lumiera_error_set (this->id_, detailInfo.c_str()); } diff --git a/src/lib/error.hpp b/src/lib/error.hpp index 1872b3166..32cb92afe 100644 --- a/src/lib/error.hpp +++ b/src/lib/error.hpp @@ -242,7 +242,7 @@ namespace lumiera { { throw error::Flag( error::detailInfo() , errorFlag); - } } //causes the error state to be set + } } /** Check the lumiera error state and throw a specific exception * in case a non-cleared errorflag is detected. No-op else. diff --git a/src/stage/gtk-lumiera.cpp b/src/stage/gtk-lumiera.cpp index 7bdf5170a..e9f1de535 100644 --- a/src/stage/gtk-lumiera.cpp +++ b/src/stage/gtk-lumiera.cpp @@ -154,10 +154,12 @@ namespace stage { } catch(...) { - if (!lumiera_error_peek()) - LUMIERA_ERROR_SET (stage, STATE, "unexpected error when starting the GUI thread"); + const char* errID = lumiera_error(); // clear C-style error flag + WARN (stage, "Unexpected error while starting the GUI thread."); + if (errID) + TRACE (stage, "Error flag was: %s", errID); return false; - } // note: lumiera_error state remains set + } } } // namespace stage diff --git a/tests/10exception.tests b/tests/10exception.tests index a2bafedf7..8fdbdf3c8 100644 --- a/tests/10exception.tests +++ b/tests/10exception.tests @@ -2,7 +2,7 @@ TESTING "Exception handling and diagnostics" ./test-suite --group=common -TEST "ExceptionError_test" ExceptionError_test < (msg); } + void detectErrorflag (string) { throwOnError(); } /** @test verify throwing of Exceptions @@ -169,12 +142,9 @@ namespace lumiera { lumiera_error_set(LERR_(LIFE_AND_UNIVERSE), "what is the answer?"); CHECK (lumiera_error_peek()); - catcher (&test::detectErrorflag, ""); - CHECK (LERR_(LIFE_AND_UNIVERSE) == lumiera_error_peek()); - - catcher (&test::detectErrorflagChained, "the big bang"); - CHECK (LERR_(LIFE_AND_UNIVERSE) == lumiera_error()); - } + catcher (&test::detectErrorflag); + CHECK (not lumiera_error_peek()); + }// yet translating that into an exception also clears the error flag /** @test the chaining of lumiera::Exception objects @@ -200,18 +170,6 @@ namespace lumiera { } - /** @test terminate the Application by throwing an undeclared exception. - * this should result in the global unknown() handler to be called, - * so usually it will terminate the test run. - * @note inside error.hpp, an initialisation hook has been installed into - * AppState, causing our own unknown() handler to be installed and - * invoked, which gives additional diagnostics.*/ - void terminateUnknown () noexcept - { - throw Error{"Catch the hedgehog..."}; - } - - /** a very specific Exception class * local to this scope and with * additional behaviour. @@ -238,7 +196,7 @@ namespace lumiera { /** helper: provides a bunch of catch-clauses and * runs the given member functions within */ - void catcher (void (ExceptionError_test::*funky)(string), string context) + void catcher (void (ExceptionError_test::*funky)(string), string context ="") { try { diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index db3895620..1f81ef8af 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -57360,6 +57360,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -80746,6 +80773,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ @@ -92193,6 +92221,7 @@ class Something +