16.2 Throwing an exception versus setting response status
When an error condition occurs in a resource class, and you don't want to be concerned with formatting the response body, you have the choice of either throwing an exception or setting the response status.
For such error conditions, you will often have an opinion on the response status code: e.g. it might be a “400 Bad Request”.
Throwing an exception might however provide for easier flow control than setting the response status. But you will often not want to define a custom exception class and corresponding configuration of the downstream filter, but still you want to be able to set the status code, provide a description and possibly a cause-throwable.
For this case, you can use:
In Kauri: the RestException class [Experimental! Feedback welcome.]
In JAX-RS: the WebApplicationException class
In Restlet: the ResourceException class