mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-12 19:38:57 +00:00
Try to improve error reporting when streaming a PCAP file. Ref #2235.
This commit is contained in:
parent
ee486b32bd
commit
c22229101f
@ -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
|
||||
|
@ -290,7 +290,12 @@ class Link:
|
||||
Dump a pcap file on disk
|
||||
"""
|
||||
|
||||
stream_content = yield from self.read_pcap_from_source()
|
||||
try:
|
||||
stream_content = yield from self.read_pcap_from_source()
|
||||
except aiohttp.web.HTTPException as e:
|
||||
log.error("Could not stream pcap file: error {}: {}".format(e.status, e.text))
|
||||
self._capturing = False
|
||||
self._project.controller.notification.emit("link.updated", self.__json__())
|
||||
with stream_content as stream:
|
||||
with open(self.capture_file_path, "wb+") as f:
|
||||
while self._capturing:
|
||||
|
Loading…
Reference in New Issue
Block a user