Skip to content

Commit b3c1b3a

Browse files
committed
Don't treat unreadable HTTP errors as Req_Errors
So that the code that catches them doesn't assume they are server responses.
1 parent 44f006c commit b3c1b3a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tern.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@ def f(port, doc):
264264
req = opener.open("http://" + localhost + ":" + str(port) + "/", json.dumps(doc).encode("utf-8"), 1)
265265
return json.loads(req.read().decode("utf-8"))
266266
except urllib.error.URLError as error:
267-
raise Req_Error((hasattr(error, "read") and error.read().decode("utf-8")) or str(error.reason))
267+
if hasattr(error, "read"):
268+
raise Req_Error(error.read().decode("utf-8"))
269+
else:
270+
raise error
268271
return f
269272

270273
if python3:

0 commit comments

Comments
 (0)