snitch
snitch copied to clipboard
Query whether snitch is expecting a throw
Is it possible to query Snitch whether it currectly expects an exception being thrown? If yes, how?
I would like to make my exception class break into debugger on each throw, when running unit tests in debugger, and exception is not expected by Snitch (eg. I am not inside any _THROWS macro).
I mean something like this (on Windows/MSVC):
MyException::MyException()
{
#ifdef UNITTESTS
if (!snitch::expecting_throw() && DebuggerPresent())
__debugbreak();
#endif
}
I realize this is not really a robust solution (exception can be caused and then consumed by different component), but still it would be a nice quality-of-life improvement in my current situation.
Hi there! It is not currently possible, no. Supporting this would not require a lot of code changes, but changes nonetheless. It seems to me more of a niche use case, and perhaps not worth the extra complexity. But others may think otherwise?