Checked vs Unchecked Exceptions in Java - My Understanding
Checked exceptions are compile-time exceptions, meaning the compiler will throw an error if it sees your code is not handling a checked exception.
The intention is to allow the developer to handle these recoverable situations gracefully.
As opposed to this, there are exceptions from which you cannot recover. For example, when a user tries to login with the wrong set of credentials, you don't really have an option but to fail the request and show an error, in this case, a 401 which prompts the client to ask the user to authenticate.
Comments
Post a Comment