Permalink
Browse files

Don't treat unreadable HTTP errors as Req_Errors

So that the code that catches them doesn't assume they
are server responses.
  • Loading branch information...
1 parent 44f006c commit b3c1b3a7ba2fc88d034998e866a37b98c3d64bb8 @marijnh marijnh committed Nov 23, 2016
Showing with 4 additions and 1 deletion.
  1. +4 −1 tern.py
View
@@ -264,7 +264,10 @@ def f(port, doc):
req = opener.open("http://" + localhost + ":" + str(port) + "/", json.dumps(doc).encode("utf-8"), 1)
return json.loads(req.read().decode("utf-8"))
except urllib.error.URLError as error:
- raise Req_Error((hasattr(error, "read") and error.read().decode("utf-8")) or str(error.reason))
+ if hasattr(error, "read"):
+ raise Req_Error(error.read().decode("utf-8"))
+ else:
+ raise error
return f
if python3:

0 comments on commit b3c1b3a

Please sign in to comment.