In this section, we're going to take a look at handling user and server-side errors in a RESTful way by using an appropriate HTTP status code, for example, HTTP status code 400 Bad Request for invalid and malformed requests, status 404 Not Found if something could not be found, and HTTP status code 500 Internal Server Error if something happens unexpectedly. We'll also see how to use WebApplicationException and its subclasses to model error handling, and finally we'll be implementing a custom ExceptionMappers to handle runtime exceptions and return custom error responses:
This is what ...