throw exceptions for http error codes