mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-11 16:41:04 +00:00
Properly catch aiohttp client exception. Ref #2228
This commit is contained in:
parent
0f02cff5f2
commit
2361e138ec
@ -150,9 +150,9 @@ class Docker(BaseManager):
|
|||||||
data=data,
|
data=data,
|
||||||
headers={"content-type": "application/json", },
|
headers={"content-type": "application/json", },
|
||||||
timeout=timeout)
|
timeout=timeout)
|
||||||
except (aiohttp.ClientResponseError, aiohttp.ClientOSError) as e:
|
except aiohttp.ClientError as e:
|
||||||
raise DockerError("Docker has returned an error: {}".format(str(e)))
|
raise DockerError("Docker has returned an error: {}".format(str(e)))
|
||||||
except (asyncio.TimeoutError):
|
except asyncio.TimeoutError:
|
||||||
raise DockerError("Docker timeout " + method + " " + path)
|
raise DockerError("Docker timeout " + method + " " + path)
|
||||||
if response.status >= 300:
|
if response.status >= 300:
|
||||||
body = await response.read()
|
body = await response.read()
|
||||||
|
@ -450,7 +450,7 @@ class Compute:
|
|||||||
elif response.type == aiohttp.WSMsgType.CLOSED:
|
elif response.type == aiohttp.WSMsgType.CLOSED:
|
||||||
pass
|
pass
|
||||||
break
|
break
|
||||||
except aiohttp.client_exceptions.ClientResponseError as e:
|
except aiohttp.ClientError as e:
|
||||||
log.error("Client response error received on compute '{}' WebSocket '{}': {}".format(self._id, ws_url,e))
|
log.error("Client response error received on compute '{}' WebSocket '{}': {}".format(self._id, ws_url,e))
|
||||||
finally:
|
finally:
|
||||||
self._connected = False
|
self._connected = False
|
||||||
|
@ -798,7 +798,7 @@ class Project:
|
|||||||
try:
|
try:
|
||||||
await compute.post("/projects/{}/close".format(self._id), dont_connect=True)
|
await compute.post("/projects/{}/close".format(self._id), dont_connect=True)
|
||||||
# We don't care if a compute is down at this step
|
# We don't care if a compute is down at this step
|
||||||
except (ComputeError, aiohttp.web.HTTPError, aiohttp.ClientResponseError, TimeoutError):
|
except (ComputeError, aiohttp.web.HTTPError, aiohttp.ClientError, TimeoutError):
|
||||||
pass
|
pass
|
||||||
self._clean_pictures()
|
self._clean_pictures()
|
||||||
self._status = "closed"
|
self._status = "closed"
|
||||||
|
Loading…
Reference in New Issue
Block a user