4 ms·
I think it's normal to catch RuntimeExceptions at a high level in your outer loop so you can log it, email it, or whatever, and not let your process die. This i
by pjungwir 14y ago
I think it's normal to catch RuntimeExceptions at a high level in your outer loop so you can log it, email it, or whatever, and not let your process die. This is what servlet containers like Tomcat are doing. I agree that catching them elsewhere raises suspicions.
The author's example seems fine, provided they can distinguish an exception-from-a-B-transaction vs an exception-from-a-program-bug. If I were him, I'd keep that checkFormat method, but only call it when I catch a RuntimeException, to see if it's something to worry about or not.
I was pleased that the author appears to have tested the performance of both approaches and is making a decision based on real numbers.