⚗️ new stop propagation method

This commit is contained in:
yanyongyu
2020-12-24 22:19:08 +08:00
parent 41663e1b08
commit 2ae76ff78b
3 changed files with 20 additions and 13 deletions

View File

@ -164,8 +164,6 @@ async def _run_matcher(Matcher: Type[Matcher], bot: "Bot", event: "Event",
try:
logger.debug(f"Running matcher {matcher}")
await matcher.run(bot, event, state)
except StopPropagation as e:
exception = e
except Exception as e:
logger.opt(colors=True, exception=e).error(
f"<r><bg #f8bbd0>Running matcher {matcher} failed.</bg #f8bbd0></r>"
@ -183,7 +181,7 @@ async def _run_matcher(Matcher: Type[Matcher], bot: "Bot", event: "Event",
"<r><bg #f8bbd0>Error when running RunPostProcessors</bg #f8bbd0></r>"
)
if matcher.block or isinstance(exception, StopPropagation):
if matcher.block:
raise StopPropagation
return