Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query whether snitch is expecting a throw #153

Open
vid512 opened this issue Jan 16, 2024 · 1 comment
Open

Query whether snitch is expecting a throw #153

vid512 opened this issue Jan 16, 2024 · 1 comment
Labels
enhancement New feature or request maybe For issues that aren't critial, or need more exploration

Comments

@vid512
Copy link

vid512 commented Jan 16, 2024

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.

@cschreib
Copy link
Member

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?

@cschreib cschreib added enhancement New feature or request maybe For issues that aren't critial, or need more exploration labels Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request maybe For issues that aren't critial, or need more exploration
Projects
None yet
Development

No branches or pull requests

2 participants