aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-02-25 13:42:22 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-02-25 13:42:22 +0300
commit4c566bb2445d0bc637e11242c44a69baa8a39e48 (patch)
treef2ab1874232322e3787994f2caa7d785878d4f6b
parentCatches All Site Startup Issues (diff)
Cleans Up Startup Error Handler Code Style
Co-authored-by: Akarys42 <[email protected]> Signed-off-by: Hassan Abouelela <[email protected]>
-rw-r--r--bot/__main__.py4
-rw-r--r--bot/bot.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/bot/__main__.py b/bot/__main__.py
index d3abcd7b2..9317563c8 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 type(e.exception) in [aiohttp.ClientConnectorError, aiohttp.ServerDisconnectedError]:
+ if isinstance(e.exception, (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?"
@@ -24,3 +24,5 @@ except StartupError as e:
log = logging.getLogger("bot")
log.fatal("", exc_info=e.exception)
log.fatal(message)
+
+ exit(69)
diff --git a/bot/bot.py b/bot/bot.py
index 1a815c31e..3218a60b4 100644
--- a/bot/bot.py
+++ b/bot/bot.py
@@ -102,7 +102,7 @@ class Bot(commands.Bot):
except (aiohttp.ClientConnectorError, aiohttp.ServerDisconnectedError) as e:
attempts += 1
if attempts == constants.URLs.connect_max_retries:
- raise e
+ raise
await asyncio.sleep(constants.URLs.connect_cooldown)
@classmethod