diff options
| author | 2021-02-25 13:23:14 +0300 | |
|---|---|---|
| committer | 2021-02-25 13:23:14 +0300 | |
| commit | 900923cc6a9b4d40b625b8f33e8bef18a286a84f (patch) | |
| tree | 7ee7b5900bd19b3ddf8a892bc93248ac696728b1 | |
| parent | Adds Site Readiness Checks (diff) | |
Catches All Site Startup Issues
Adds a missing exception when trying to connect to the site on startup.
Signed-off-by: Hassan Abouelela <[email protected]>
| -rw-r--r-- | bot/__main__.py | 2 | ||||
| -rw-r--r-- | bot/bot.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/bot/__main__.py b/bot/__main__.py index e4df4b77d..d3abcd7b2 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -15,7 +15,7 @@ try: bot.instance.run(constants.Bot.token) except StartupError as e: message = "Unknown Startup Error Occurred." - if isinstance(e.exception, aiohttp.ClientConnectorError): + if type(e.exception) in [aiohttp.ClientConnectorError, aiohttp.ServerDisconnectedError]: message = "Could not connect to site API. Is it running?" elif isinstance(e.exception, OSError): message = "Could not connect to Redis. Is it running?" diff --git a/bot/bot.py b/bot/bot.py index cd8e26325..1a815c31e 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -99,7 +99,7 @@ class Bot(commands.Bot): await self.api_client.get("healthcheck") break - except aiohttp.ClientConnectorError as e: + except (aiohttp.ClientConnectorError, aiohttp.ServerDisconnectedError) as e: attempts += 1 if attempts == constants.URLs.connect_max_retries: raise e |