Raise error for bad HTTP status codes