Skip to content

Commit c678175

Browse files
committed
Fix guard runner
1 parent 150fb49 commit c678175

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

twitchio/ext/commands/core.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,18 +390,17 @@ async def _guard_runner(self, guards: list[Callable[..., bool] | Callable[..., C
390390
result = guard(*args)
391391
if asyncio.iscoroutine(result):
392392
result = await result
393+
except GuardFailure:
394+
raise
393395
except Exception as e:
394-
if isinstance(e, GuardFailure):
395-
raise
396-
397396
raise GuardFailure(exc_msg, guard=guard) from e
398397

399398
if result is not True:
400399
raise GuardFailure(exc_msg, guard=guard)
401400

402401
async def _run_guards(self, context: Context) -> None:
403402
# Run global guard first...
404-
await context.bot.global_guard(context)
403+
await self._guard_runner([context.bot.global_guard], context)
405404

406405
# Run component guards next, if this command is in a component...
407406
if self._injected is not None and self._injected.__all_guards__:

0 commit comments

Comments
 (0)