aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author苏向夜 <fu050409@163.com>2023-12-14 17:08:47 +0800
committer苏向夜 <fu050409@163.com>2023-12-14 17:08:47 +0800
commit1efeba89c3c1463f57dfe33d80aa98c206605e1f (patch)
treeb0943798fa88003e9ac761f5772c40b6ace9b9fc /src
parent92c23714e2abe03158202b02915379f843aed8c9 (diff)
downloadinfini-1efeba89c3c1463f57dfe33d80aa98c206605e1f.tar.gz
infini-1efeba89c3c1463f57dfe33d80aa98c206605e1f.zip
:sparkles: 使用抛出异常替代返回异常
Diffstat (limited to 'src')
-rw-r--r--src/infini/event.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/infini/event.py b/src/infini/event.py
index 21dc724c..f456500a 100644
--- a/src/infini/event.py
+++ b/src/infini/event.py
@@ -1,6 +1,6 @@
from abc import ABCMeta
from .typing import Dict
-from .logging import logger
+from .exceptions import UnknownMessageEvent
import re
@@ -18,8 +18,7 @@ class Events:
def process(self, name: str, **kwargs) -> str:
if string := self._events.get(name.lower()):
return self._format(string, **kwargs)
- logger.warning(f"事件[{name.lower()}]不存在,将返回空字符串!")
- return ""
+ raise UnknownMessageEvent(f"事件[{name.lower()}]不存在!")
def _format(self, string: str, **kwargs):
pattern = r"{(.*?)}"