Error handling in the readme
Closed this issue · 3 comments
These raised exceptions do not have amessage
attribute. Thus the log message in the readme fails with AttributeError
.
Also the exception definition doesn't contain an error_code
attribute
except sdk.errors.CheckoutSdkError as e:
print('{0.http_status} {0.error_code} {0.elapsed} {0.event_id} // {0.message}'.format(e))
https://github.com/checkout/checkout-sdk-python#payment-request-example-with-n3d-downgrade-option
Also 'error_codes'
seems like a valuable attribute to have on the error logging e.g: ['customer_id_invalid', 'destination_token_invalid']
The sdk seems ok - there are some minor bugs in the sdk that will be addressed.
Since we are using dynamic attributes so the 3ds should be accessed with this:
print ( payment['3ds'].downgraded) instead of print ( payment.3ds.downgraded)
Are you able to access these attributes on the exception?
print('{0.http_status} {0.error_code} {0.elapsed} {0.event_id} // {0.message}'.format(e))
Please replace the exception into the below and it should work.
print('{0.http_status} {0.error_codes} {0.elapsed} {0.request_id} - {0.error_type}'.format(e))