Skip to content

Commit 0489abd

Browse files
committed
make the exception less messy & just return once we've reached the time limit
1 parent 69682dc commit 0489abd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

modules/github.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ def _strip_content_path(self, url: str) -> str:
6161
async def format_highlight_block(self, url: str, line_adjustment: int = 10):
6262
try:
6363
highlighted_line = int(url.split("#L")[1]) # seperate the #L{n} highlight
64-
except Exception as err:
65-
if isinstance(err, IndexError):
66-
return None
64+
except IndexError:
65+
return
6766

6867
file_path = self._strip_content_path(url)
6968
raw_url = GITHUB_RAW_CONTENT_URL + file_path.replace("blob/", "") # Convert it to a raw user content URL
@@ -159,9 +158,8 @@ def check(reaction, user):
159158
content="Showing lines `{}` - `{}` in: `{}`...\n{}".format(_min, _max, path, code_fmt),
160159
suppress_embeds=True
161160
)
162-
163161
except asyncio.TimeoutError:
164-
await message.clear_reactions()
162+
return
165163

166164

167165
async def setup(bot: Bot) -> None:

0 commit comments

Comments
 (0)