aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-03-06 03:56:18 +0100
committerGravatar Numerlor <[email protected]>2021-03-06 04:06:29 +0100
commit51a11cc4b1ff9a4de0dfa33490ae7fceec96423d (patch)
tree14c88d81e30675711e96c8635974ebc8edc3e6b6
parentCreate the footer text before an inventory refresh can occur (diff)
Handle unexpected errors when requesting markdown
-rw-r--r--bot/exts/info/doc/_cog.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py
index c01e0f36a..0334f6001 100644
--- a/bot/exts/info/doc/_cog.py
+++ b/bot/exts/info/doc/_cog.py
@@ -9,6 +9,7 @@ from contextlib import suppress
from types import SimpleNamespace
from typing import Dict, NamedTuple, Optional, Union
+import aiohttp
import discord
from discord.ext import commands
@@ -257,7 +258,17 @@ class DocCog(commands.Cog):
if markdown is None:
log.debug(f"Redis cache miss with {doc_item}.")
- markdown = await self.item_fetcher.get_markdown(doc_item)
+ try:
+ markdown = await self.item_fetcher.get_markdown(doc_item)
+
+ except aiohttp.ClientError as e:
+ log.warning(f"A network error has occurred when requesting parsing of {doc_item}.", exc_info=e)
+ return "Unable to parse the requested symbol due to a network error."
+
+ except Exception:
+ log.exception(f"An unexpected error has occurred when requesting parsing of {doc_item}.")
+ return "Unable to parse the requested symbol due to an error."
+
if markdown is None:
return "Unable to parse the requested symbol."
return markdown