diff options
| author | Martin Hořeňovský | 2025-07-27 20:28:51 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2025-07-27 21:41:02 +0200 |
| commit | d547cae549f484dda3c6a2b3cc5f71b9db40e842 (patch) | |
| tree | fb947c6dd70b9eb5e8d7fd792bd85684b454d0fd /src/catch2/internal | |
| parent | fee81626d2a4811095c3a39d20fb355eeb954101 (diff) | |
| download | catch3-d547cae549f484dda3c6a2b3cc5f71b9db40e842.tar.gz | |
Fix bad error reporting for nested exceptions in default configuration
Bad handling of `TestFailureException` when translating unexpected
exceptions inside assertion macros led to the unexpected exceptions
handling erroring out through throwing the same exception again.
This was then backstopped by the machinery for handling uncaught
exceptions from assertions, which is normally used by the
`CATCH_CONFIG_FAST_COMPILE` machinery, where we assume that it can
only be invoked because the assertion macros are not configured to
catch assertions.
Closes #1292
Diffstat (limited to 'src/catch2/internal')
| -rw-r--r-- | src/catch2/internal/catch_exception_translator_registry.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/catch2/internal/catch_exception_translator_registry.cpp b/src/catch2/internal/catch_exception_translator_registry.cpp index 1eb61147..8867d78b 100644 --- a/src/catch2/internal/catch_exception_translator_registry.cpp +++ b/src/catch2/internal/catch_exception_translator_registry.cpp @@ -59,10 +59,10 @@ namespace Catch { // To avoid having to handle TFE explicitly everywhere, we just // rethrow it so that it goes back up the caller. catch( TestFailureException& ) { - std::rethrow_exception(std::current_exception()); + return "{ nested assertion failed }"; } catch( TestSkipException& ) { - std::rethrow_exception(std::current_exception()); + return "{ nested SKIP() called }"; } catch( std::exception const& ex ) { return ex.what(); |