Properly catch aiohttp client exception. Ref #2228

This commit is contained in:
grossmj 2023-05-30 16:17:12 +09:30
parent 0f02cff5f2
commit 2361e138ec
3 changed files with 4 additions and 4 deletions

View File

@ -150,9 +150,9 @@ class Docker(BaseManager):
data=data,
headers={"content-type": "application/json", },
timeout=timeout)
except (aiohttp.ClientResponseError, aiohttp.ClientOSError) as e:
except aiohttp.ClientError as e:
raise DockerError("Docker has returned an error: {}".format(str(e)))
except (asyncio.TimeoutError):
except asyncio.TimeoutError:
raise DockerError("Docker timeout " + method + " " + path)
if response.status >= 300:
body = await response.read()

View File

@ -450,7 +450,7 @@ class Compute:
elif response.type == aiohttp.WSMsgType.CLOSED:
pass
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))
finally:
self._connected = False

View File

@ -798,7 +798,7 @@ class Project:
try:
await compute.post("/projects/{}/close".format(self._id), dont_connect=True)
# 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
self._clean_pictures()
self._status = "closed"