Strictly REST — API Exception and Error Handling — A Spring @RestControllerAdvice Approach

API developers wrestle with myriad ways to manage errors and exceptions related to business logic, infrastructure (databases, other APIs), and unhandled concerns in an ad-hoc way, before constructing a response to a REST call.

If you don’t know the answers to these and how to elegantly manage these, please read on:

  1. When should you respond with 400 BAD REQUEST vs 404 NOT FOUND for a given GET request?
  2. When should you respond…