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 we'll do conceptually in this section: we'll again extend our library microservice by several HTTP status codes , for example, HTTP 400 if you issue an invalid book update, 409 for creating an already existing book...