-
-
Notifications
You must be signed in to change notification settings - Fork 877
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
Exceptions - Documentation, Hierarchy & Naming. #949
Comments
Current hierarchy looks like this... Transport Errors, mapped from
|
httpx exceptions does not inherit from HTTPError anymore. This may break again in the future... encode/httpx#949 So this change: * removes the httpx monkeypatching * put all http related error in clients/http.py * adds catch HTTP Connection related Exception again The rest of the code does not import httpx for caching exception anymore. Fixes MERGIFY-ENGINE-1KZ MERGIFY-ENGINE-1KY
+1 in favor of mapping the httpcore exceptions to a unified hierarchy of httpx exceptions. I have a library that I recently updated from httpx 0.12 to 0.13 and found that getting the equivalent of |
I've also run into the same thing. Before, I know that catching In general, it would be nice to have some sort of exception where I know that catching that exception would catch all Edit: I saw this comment #884 (comment) which reassures me that catching |
I just upgraded a project from httpx 0.12 to 0.13 and found a few things broke since Also, it seems that I'm getting httpcore exceptions being raised, not httpx exceptions. I assume this is also a bug? |
@iwoloschin As per #884 (comment) yes, any exception leaking from |
I'm labelling this as "bug" as well since obviously currently the "HTTPX may raise exceptions that aren't mapped under its base class" is being considered a problem now and should be addressed by reviewing the exception hierarchy. I'm also wondering if we'd need a "base exception" in |
I think its is probably related. the AsyncClient.get method current throws httpcore._exceptions.ReadTimeout rather than an exception that should be exposed. ( assuming _exceptions is supposed to be private). |
I've been reviewing this lately, and I think I've got a clear idea how we could improve things a little.
☩: Maps with An important thing to note here is that there's some places where we're drawing the heirarchy along semantic lines, rather than behavioural lines. Ie. both With that in mind, here's how an alternate hierarchy could look...
Note that in this case we do now have a We can be a bit more precise about There's a couple of minor tweaks we might need beyond that. We'd possibly need a |
I'm milestoning this as 0.14. That might be a push, I'm not sure, but the rationale for doing so is that post 0.14 everything else we've got left on the table is generally behavioural polishing (eg. charset handling, dropping HSTS, HTTP/2 as optional) rather than API changes. I'd be okay with us dropping it from the milestone if needed. |
I agree that we most likely want this for 0.14. :-) |
After encode/httpcore#128 and encode/httpcore#129 we're looking at this...
|
Now resolved. Documentation upcoming in #1138 |
We ought to comprehensively revisit our exceptions for 1.0, and make sure we're super happy we've got a public API we're happy to stick by for 1.0.
.request
/.response
attributes (can we make either of these mandatory in some cases?)See also: #940, #884, #869.
The text was updated successfully, but these errors were encountered: