Closes #574 by throwing RestException subclasses instead of IllegalStateException.
Merge commit '62ad938a24d69ba70cbc9c472e9ffe4ab946aafc' into HEAD