This article presents a pragmatic, clean approach to working with exceptions in the Java applications we build today.
exceptions
Presenting Exceptions to Users
Many applications want to present the errors to their users in a nice human-readable form. This article covers some widely used best practices on this topic. Before we even start, let’s make it clear: NEVER …
Exceptions and Streams
Java 8 gave us Optional, a mighty weapon against the most frequent Exception in Java: NullPointerException, that I talked about in this blog post. However, Java 8 also brought new headaches regarding exceptions, as the …
Hide Checked Exceptions with SneakyThrows
Java is the only programming language in the world that has checked exceptions, which forces the caller to know about the individual exception types thrown by the called function. What do you do when you …
Avoiding NullPointerException
The terrible NullPointerException (NPE in short) is the most frequent Java exception occurring in production, acording to a 2016 study. In this article we’ll explore the main techniques to fight it: the self-validating model and …