catch the right error, boris

This commit is contained in:
Alex Grintsvayg 2019-11-13 17:58:47 -05:00
parent 19c3b2f4b6
commit 68d1157495
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5

View file

@ -92,7 +92,7 @@ async def monitor(db, server):
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(10)) as session: async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(10)) as session:
try: try:
ws = await session.ws_connect(server) ws = await session.ws_connect(server)
except (aiohttp.ClientConnectorError, asyncio.TimeoutError): except (aiohttp.ClientConnectionError, asyncio.TimeoutError):
if first_attempt: if first_attempt:
print(f"failed connecting to {server}") print(f"failed connecting to {server}")
await boris_says(random.choice([ await boris_says(random.choice([
@ -130,7 +130,7 @@ async def monitor(db, server):
await handle_analytics_event(c, event, server) await handle_analytics_event(c, event, server)
db.commit() db.commit()
except (aiohttp.ClientConnectorError, asyncio.TimeoutError): except (aiohttp.ClientConnectionError, asyncio.TimeoutError):
await boris_says(random.choice([ await boris_says(random.choice([
f"<!channel> Guys, we have a problem! Nobody home at {server}. Will check on it again in {delay} seconds.", f"<!channel> Guys, we have a problem! Nobody home at {server}. Will check on it again in {delay} seconds.",
f"<!channel> Something wrong with {server}. I think dead. Will poke it again in {delay} seconds.", f"<!channel> Something wrong with {server}. I think dead. Will poke it again in {delay} seconds.",