class RestExceptionHandler extends ResponseEntityExceptionHandler {

    @ExceptionHandler( value = { RestResponseEntityException.class } )
    @ResponseBody
    public ResponseEntity<RestError> handleResponseEntityException( RestResponseEntityException e, WebRequest request )
    {
        return new ResponseEntity<>( new RestError( e.getMessage() ), e.getHttpStatus() );
    }

}