Handle AttributeError exceptions when checking code of HTTPError