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

Consider renaming HTTPError to RequestError #1064

Closed
florimondmanca opened this issue Jul 16, 2020 · 3 comments
Closed

Consider renaming HTTPError to RequestError #1064

florimondmanca opened this issue Jul 16, 2020 · 3 comments
Labels
user-experience Ensuring that users have a good experience using the library

Comments

@florimondmanca
Copy link
Member

Spun up from #867

Currently httpx.HTTPError serves as a base exception class, no problem. (In 0.13.x it wasn't the case because HTTPCore could raise independant exception due to a lack of mapping, but this was fixed via #1044 and #1045.)

However with #949 and 1.0 in mind, I think there's a case to be made for this exception to be renamed to something else, most likely httpx.RequestError.

The motivation discussed in #867 was to make .raise_from_status() raise a dedicated HTTPStatusError exception, different from the base class. (There's an implementation of this in in #869.) I think it's a valid use case.

But either way another reason why I think HTTPError might not be ideal is that it's very close but different from HTTPXError, which feels a bit misleading (has an "isn't it a typo?" kind of vibe to it).

So, should we switch to httpx.RequestError?

@tomchristie
Copy link
Member

Big plus one from me on HTTPStatusError - that makes a lot of sense.

I'm not 100% sure about the renaming.

@StephenBrown2
Copy link
Contributor

StephenBrown2 commented Jul 17, 2020

Why not simply httpx.Error as the base exception? Too general?

Just a thought, if there's a RequestError, why wouldn't there be a ResponseError?

@florimondmanca
Copy link
Member Author

Yep, looking at it again the rename doesn't sound absolutely necessary or relevant - Stephen's note on the ambiguity of RequestError w/o ResponseError is a good point. :-)

Closing this, the HTTPStatusError idea is now tracked in #1067.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-experience Ensuring that users have a good experience using the library
Projects
None yet
Development

No branches or pull requests

3 participants