2 ms·
try { } catch (Exception ex) { // Gotcha! } I see this a lot in Java code. However, this does not catch all exceptional conditions, specifically not Errors.
by ternaryoperator 13y ago
try {
}
catch (Exception ex) {
// Gotcha!
}
I see this a lot in Java code. However, this does not catch all exceptional conditions, specifically not Errors. If you want to do catch everything, then catch Throwable, rather than Exception.
- ipogios 13y agoHowever, this does not catch all exceptional conditions You say that as if it is a bad thing. If you are catching Throwables, and hence Errors, you are likely doing something very wrong.