My two points below do not exactly determine the name of your question, but I think they might be useful ...
I confirm your effectiveness.
I read about the solution in java execution. We applied this to our own application, with a few exceptions (where the stack trace is not important and the possible frequency is high). I do not know if you will like it ...; -)
Create a unique instance of the Exception class and save it. Throw this instance away .
This seems ideal if you do not want to disrupt an existing thread that relies on exceptions.
If your compiler complains that the other method does not throw this exception, this is because you have selected the marked exception.
Use a subclass of RuntimeException (they are not marked, so the compiler does not know if they are thrown or not, it will not complain).
source share