Try to improve error reporting when streaming a PCAP file. Ref #2235.

This commit is contained in:
grossmj
2017-09-01 17:10:24 +07:00
parent ee486b32bd
commit c22229101f
2 changed files with 12 additions and 1 deletions

View File

@ -348,6 +348,12 @@ class Compute:
response = yield from self._session().request("GET", url, auth=self._auth, timeout=None)
if response.status == 404:
raise aiohttp.web.HTTPNotFound(text="{} not found on compute".format(path))
elif response.status == 403:
raise aiohttp.web.HTTPForbidden(text="forbidden to open {} on compute".format(path))
elif response.status != 200:
raise aiohttp.web.HTTPInternalServerError(text="Unexpected error {}: {}: while opening {} on compute".format(response.status,
response.reason,
path))
return StreamResponse(response)
@asyncio.coroutine