Incorrectly typed exception
Closed this issue · 2 comments
The CheckoutApiException
has incorrectly defined types
Description
The CheckoutApiException is defined as having error_details
as a dict
when we can see in the __init__
method that self.error_details
can be set to None
. Thus error_details
is actually Optional[dict]
.
However, in some cases error_details
may not be set when response.text
is null
or missing. An example of such case is when the API responds with a 403
on a payout, error_details
is not an available attribute on this exception. Which also means the python examples in the documentation isn't complete for this case and raises an AttributeError on 403.
Lastly error_details
should actually be a list
instead of a dict
according to the API documentation, as you can see in the image provided the API mentions that error_codes
is an array
Additional information
A final point, it would be worthwhile introducing some clear data structures to this library as most of the structs have to be guessed by reading the attributes in the tests. This would be far more helpful than trying to figure out the struct from a nested ResponseWrapper object.
Thank you very much @Foxyblue for your comments.
We will revise and make any necessary changes in future releases as far as possible.
New release pending