Quantcast
Viewing all articles
Browse latest Browse all 40

Why throw early and catch late?

here asks:

There are many well-known best practices about exception handling in isolation. I know the "do's and don'ts" well enough, but things get complicated when it comes to best practices or patterns in larger environments. "Throw early, catch late" — I've heard many times and it still confuses me.

Why should I throw early and catch late, if at a low-level-layer a null pointer exception is thrown? Why should I catch it at a higher layer? It doesn't make sense for me to catch a low-level exception at a higher level, such as a business layer. It seems to violate concerns of each layer.

Read full article

Comments


Viewing all articles
Browse latest Browse all 40

Trending Articles