DNS timeouts have a traceback that is confusing for users. #580
tomchristie
started this conversation in
General
Replies: 1 comment 3 replies
-
We could just do
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Prompted by this user comment... encode/httpx#2167 (comment)
When we see DNS timeouts in
httpx
async users will end up with a traceback that looks like this...This looked confusing to me since it starts with the
ValueError: 'api.github.com' does not appear to be an IPv4 or IPv6 address
line.Once I'd dug into the source for anyio 3.7 it made sense...
anyio/src/anyio/_core/_sockets.py
Lines 187 to 194 in f7a880f
...okay, is this an IP address? If not, raise an exception and then perform DNS lookup.
So the behaviour is valid and correct. But I'm wondering if there's any scope for a UX improvement here?
Restructuring the code so that the DNS lookup doesn't occur within an
except
block would result in a more obvious stacktrace for this fairly common exception case.Beta Was this translation helpful? Give feedback.
All reactions