throw exception if HTTP request didn't succeed