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
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).
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.
Activity
lovelydinosaur commentedon Jul 17, 2020
Big plus one from me on
HTTPStatusError- that makes a lot of sense.I'm not 100% sure about the renaming.
StephenBrown2 commentedon Jul 17, 2020
Why not simply
httpx.Erroras the base exception? Too general?Just a thought, if there's a
RequestError, why wouldn't there be aResponseError?florimondmanca commentedon Jul 18, 2020
Yep, looking at it again the rename doesn't sound absolutely necessary or relevant - Stephen's note on the ambiguity of
RequestErrorw/oResponseErroris a good point. :-)Closing this, the
HTTPStatusErroridea is now tracked in #1067.