InAppPy icon indicating copy to clipboard operation
InAppPy copied to clipboard

AttributeError: 'InAppPyValidationError' object has no attribute 'raw_response'

Open schumannd opened this issue 4 years ago • 1 comments

Description

This error arose while using the recommended error handling from the readme:

except InAppPyValidationError as ex:
    response = ex.raw_response  # contains actual response from AppStore service.
    reporter.send_error_report(response)

Expected Behavior

Shouldn't fail

Actual Behavior

the line before the error gets reported to us failed

Context

this bug was caught by our automated error monitor. In the breadcrumbs I found, that the URL "https://buy.itunes.apple.com/verifyReceipt" was queried twice:

It returned status code [503] Service Unavailable the first time. The second time it returned [null].

There was also a JSONDecodeError: Expecting value: line 1 column 1 (char 0) somewhere. Maybe in the InAppPy packet? maybe a handling of a null value return needs to be added somewhere? And maybe that is why raw_response was not set? It should still exist in the object though to avoid errors like this.

That's a lot of maybes, because unfortunately the bredcrumbs don't show exactly what code line was executed.

Your Environment

inapppy==2.3 Django==2.1 python-3.7.0

schumannd avatar Dec 05 '19 07:12 schumannd

Similar problem here.

This seems to be a problem from appstore.py:68 assuming that the response will contain valid json, if it does not, inapppy raises InAppPyValidationError("HTTP error") taht have no useful info at all.

DataGreed avatar Jan 24 '20 16:01 DataGreed