3 ms·
Isn't it effectively the same thing as swallowing Throwable with an empty catch block in Java?
by alboy 6y ago
Isn't it effectively the same thing as swallowing Throwable with an empty catch block in Java?
- londons_explore 6y agoYes, but you need to wrap every line of source code in your whole program (and all libraries) with an empty catch block to have the same result. Just a single top level catch block would prevent other code after the error occurred from running, which might still be able to work fine without the results of the faulty code.
- alboy 6y agoI see. I'm just not sure that situations where this way of exception handling is a viable strategy are common enough to warrant this syntactic sugar (which seems very easy to misuse). The Visual Basic docs also recommend using structured exception handling instead. Perhaps it is more useful in scripting contexts.
- the_af 6y agoThey are not viable strategies, which is why the analogous strategies in modern-day languages are heavily discouraged and wouldn't pass a code review.