aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-06-12 19:01:32 +0200
committerGravatar Numerlor <[email protected]>2021-06-12 19:01:32 +0200
commitc2122316e5a34a2b9776e5e965a9434e748ab601 (patch)
tree44aebe9c4ed0a2cc0b9a4c96e354ed992f1f607a
parentAdd Optional typehint to parameter (diff)
Move the suppressed_exceptions argument to an optional kwarg
Forcing it to be passed as a kwarg makes it clearer what the exceptions are for from the caller's side.
-rw-r--r--bot/utils/messages.py2
-rw-r--r--bot/utils/scheduling.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/bot/utils/messages.py b/bot/utils/messages.py
index b6f6c1f66..d4a921161 100644
--- a/bot/utils/messages.py
+++ b/bot/utils/messages.py
@@ -54,7 +54,7 @@ def reaction_check(
log.trace(f"Removing reaction {reaction} by {user} on {reaction.message.id}: disallowed user.")
scheduling.create_task(
reaction.message.remove_reaction(reaction.emoji, user),
- HTTPException, # Suppress the HTTPException if adding the reaction fails
+ suppressed_exceptions=(HTTPException,),
name=f"remove_reaction-{reaction}-{reaction.message.id}-{user}"
)
return False
diff --git a/bot/utils/scheduling.py b/bot/utils/scheduling.py
index d3704b7d1..bb83b5c0d 100644
--- a/bot/utils/scheduling.py
+++ b/bot/utils/scheduling.py
@@ -163,7 +163,8 @@ class Scheduler:
def create_task(
coro: t.Awaitable,
- *suppressed_exceptions: t.Type[Exception],
+ *,
+ suppressed_exceptions: tuple[t.Type[Exception]] = (),
event_loop: t.Optional[asyncio.AbstractEventLoop] = None,
**kwargs,
) -> asyncio.Task: