Skip to content

Commit a86e7cf

Browse files
committed
upip: Report host name resolve error in user friendly manner.
1 parent 0689880 commit a86e7cf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

upip/upip.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ def expandhome(s):
105105
def url_open(url):
106106
global warn_ussl
107107
proto, _, host, urlpath = url.split('/', 3)
108-
ai = usocket.getaddrinfo(host, 443)
108+
try:
109+
ai = usocket.getaddrinfo(host, 443)
110+
except OSError as e:
111+
fatal("Unable to resolve %s (no Internet?)" % host, e)
109112
#print("Address infos:", ai)
110113
addr = ai[0][4]
111114

0 commit comments

Comments
 (0)