Closed GClunies closed 3 years ago
Thanks for reporting this @GClunies . It is a very valid point.
I'll review your PR as soon as possible.
@GClunies I have merged your PR and pushed a small modification : the code is stored as an int (rather than converting it when checking for its value) and I renamed the field status_code
(rather than just code)
I'll make a PyPI release soon.
Thanks again for this addition.
Thanks @ppawlak!
Version 0.8.4 with your PR is on PyPI : https://pypi.org/project/appstoreconnect/0.8.4/
Happy to take a stab at this @ppawlak.
Issue Description
Ideally, when an
APIError
exception is raised, theAPIerror
should also expose the HTTP status code as defined in the Apple docs. I think the best way to do this is to add the HTTP status code as an attribute to theAPIError
object so that the end user can check against this value.By exposing the HTTP status code to the end user as an attribute, errors can be maintained as contracts. Currently the only way to check for a
APIError
is using the error description. Something like...If Apple changes the error description slightly this approach will break. I would expect the HTTP status codes to be much more stable.