We're using currency-cloud==5.0.1 and encountered this error in our production logs:
...
File "/usr/local/lib/python3.9/site-packages/currencycloud/clients/rates.py", line 16, in detailed
return resources.Rate(self, **self.get('/v2/rates/detailed', query=kwargs))
File "/usr/local/lib/python3.9/site-packages/currencycloud/http.py", line 33, in get
return self.__handle_errors('get', url, query, response)
File "/usr/local/lib/python3.9/site-packages/currencycloud/http.py", line 104, in __handle_errors
raise klass(verb, url, params, response)
File "/usr/local/lib/python3.9/site-packages/currencycloud/errors/api.py", line 44, in __init__
ApiError.ApiErrorMessage(
File "/usr/local/lib/python3.9/site-packages/currencycloud/errors/api.py", line 12, in __init__
self.params = error['params']
KeyError: 'params'
It seems like the error catching code is unable to properly catch the error because the params key is missing from the error itself.
We're upgrading to 5.1.2 to see if it fixes the issue, but the error is hard to reproduce because it is so transient, and the fix in PR #75 doesn't explicitly check for the existence of the params key before passing the message(s)/error to the ApiError.ApiErrorMessage constructor.
The reason I believe #75 might not fix the issue is because the previous lines of code in __init__ that reference the error param don't throw errors, and they would if it was of type list:
def __init__(self, field, error):
self.field = field
self.code = error['code']
self.message = error['message']
self.params = error['params']
We're using
currency-cloud==5.0.1and encountered this error in our production logs:It seems like the error catching code is unable to properly catch the error because the
paramskey is missing from the error itself.We're upgrading to
5.1.2to see if it fixes the issue, but the error is hard to reproduce because it is so transient, and the fix in PR #75 doesn't explicitly check for the existence of theparamskey before passing the message(s)/error to theApiError.ApiErrorMessageconstructor.The reason I believe #75 might not fix the issue is because the previous lines of code in
__init__that reference the error param don't throw errors, and they would if it was of type list: