Start United States USA — software Programming BS: Checked Exceptions

Programming BS: Checked Exceptions

148
0
TEILEN

Learn more on how to handle checked exceptions in code and how to avoid unnecessary use of exception handling.
Join the DZone community and get the full member experience. I have always hated being forced to catch an exception, largely because: If you look at Java code as an example, people use various strategies to try to deal with checked exceptions, such as: This leads to various problematic results: At the end of the day, this is why I like the Go usage of panic and defer in place of checked exceptions. It has some decided advantages: What if you’re using a language like Java? I think a good solution is to write a Try class that has various static methods, each of which represents a particular situation.

Continue reading...