dagblog.
← Archive

When to catch exceptions


Under this title is a very well written, easy-to-understand article about 
 working with exceptions in Java. 
 Dave Schweisguth asks which type of
 exception to throw, but above all explains why it’s important always to throw the specific exception type instead of its superclass.

The author points out the misuse of exceptions such as jaav.lang.Error and 
 java.lang.RuntimeException, which many programmers use as crutches
 instead of specifying a particular error type. Worse still, programmers
 even throw these exceptions deliberately, although they’re very difficult to handle and manage.

Medium version

Related articles

Related CZ Podcast episodes