-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Internal Code
-
None
-
Fully Compatible
-
Service arch 2020-12-28
ASSERT statements in unit tests throw TestAssertionFailureException.
It is deliberately not derived from std::exception or anything else, so that users won't be tempted to catch it. But the terminate handler is special. The process is dying and this is the only chance we have to figure out what the heck happened. We could make a special carve out for the terminate handler to catch and print TestAssertionFailureException.
Idea:
We can even do this by making the terminate handler wildcard catch(...) go through a global registry of Lippincott functions to see if any of them can identify the current exception and produce good diagnostics for it. It's perhaps unreasonable to expect that the global terminate handler can have a special case for every kind of exception that might be active. Libraries (fmt, boost, unittest) introduce their own exception types. That's fine as long as they can also add handlers to print diagnostics.
- is related to
-
SERVER-53035 provide a way to ASSERT from a non-main thread in unit tests
- Closed