URLFile: include url in bad status code error

old-commit-hash: 8ca12dac278d58fa4486fc6d01a3de8b81fbe1ad
This commit is contained in:
Andy Haden
2020-03-23 21:23:33 -07:00
parent afe66c742e
commit 49915461a4

View File

@@ -72,7 +72,8 @@ class URLFile(object):
if response_code == 416: # Requested Range Not Satisfiable
return ""
if response_code != 206 and response_code != 200:
raise Exception("Error {}: {}".format(response_code, repr(dats.getvalue())[:500]))
raise Exception("Error {} ({}): {}".format(response_code, self._url, repr(dats.getvalue())[:500]))
ret = dats.getvalue()
self._pos += len(ret)