Skip to content

Consider renaming HTTPError to RequestError #1064

Closed

Description

@florimondmanca

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?

Activity

  1. lovelydinosaur commented on Jul 17, 2020

    @lovelydinosaur
    Member

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

    I'm not 100% sure about the renaming.

  2. StephenBrown2 commented on Jul 17, 2020

    @StephenBrown2
    Contributor

    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?

  3. florimondmanca commented on Jul 18, 2020

    @florimondmanca
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    user-experienceEnsuring that users have a good experience using the library

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions