You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
On Fri, 17 May, 2024, 11:42 am Gal Birka, ***@***.***> wrote:
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.
—
Reply to this email directly, view it on GitHub
<#213>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4U6ZMUQJOSAPKHUA2RON33ZCWNTBAVCNFSM6AAAAABH3QDOVOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGMYDCOJQGM4DONI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
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.
The text was updated successfully, but these errors were encountered: