error handling issue
Closed this issue · 3 comments
For '/payments/{id}/confirmation': request, when api is returning 403 error, the SDK is not able to handle it due to invalid data type return from server.
Method is expecting an array like:
[{'code': 'api_key_length_is_invalid', 'message': 'api_key should be 64 character(s) long', 'params': {'length': 64}}]
but it's returning:
{'code': 'payment_confirmations_permission_missing', 'message': 'Payment confirmations permission missing for current user', 'params': {}}
so the sdk is returning the following error:
TypeError: string indices must be integers
There are two possible solutions:
- Return an array of errors from your server.
- Edit the below code to check if
errors['error_messages']
is an array or not and act accordingly (I can submit a PR for this if needed).
currencycloud-python/src/currencycloud/errors/api.py
Lines 40 to 45 in 670555c
same happening in: /payments/{id}/delete
(POST) and all report routes
Thanks for raising this issue @juancastingo. We will fix it in the next release of the SDK.
If you would like to contribute (we welcome pull requests from everyone!) please see the CONTRIBUTING page for guidelines on what to do.
Fixed server-side