We already setup WebApplicationExceptionMapper to convert WebApplicationExceptions to ErrorMessages and set the correct response code. However, the error code reported in the JSON response is just the HTTP status code. It should be easy to customize the error code to provide more machine readable information (to complement the human readable error message) while maintaining the HTTP status code.
This could either work with the existing exception mapper (i.e. subclass WebApplicationException and detect the subtype when converting to ErrorMessage) or use it's own independent type. Either way, it would also be helpful to provide all the convenience subclasses like NotFoundException as well.
We already setup WebApplicationExceptionMapper to convert WebApplicationExceptions to ErrorMessages and set the correct response code. However, the error code reported in the JSON response is just the HTTP status code. It should be easy to customize the error code to provide more machine readable information (to complement the human readable error message) while maintaining the HTTP status code.
This could either work with the existing exception mapper (i.e. subclass WebApplicationException and detect the subtype when converting to ErrorMessage) or use it's own independent type. Either way, it would also be helpful to provide all the convenience subclasses like NotFoundException as well.