Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIError support for Status Code #213

Open
birkagal opened this issue May 17, 2024 · 1 comment
Open

APIError support for Status Code #213

birkagal opened this issue May 17, 2024 · 1 comment

Comments

@birkagal
Copy link

Hey there.
When using this client, I found this weird behavoiur that the raised APIError contain only a spesific string for every type of error (502, 401 etc) and for others (like 404, which is pretty common..) it just add the text from the http response.. Which again is a very spesific string.

A much better approach is to also add the status code itself to the exception, and whenever the user catch the exception he can check for example if the status is 404 instead of checking that spesific string (which is what I'm currently doing 😃 ) .

So in short, I think we should add support for HTTP Status codes inside the APIError, whenever its appropiate.
There are cases we use APIError not when there is an actual HTTPError, so status_code can be None.

@Rajpatel143
Copy link

Rajpatel143 commented May 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants