rest client - error handling