catch command exception
This commit is contained in:
parent
d2bcb197eb
commit
521b960364
@ -201,10 +201,15 @@ class Command(metaclass=Singleton):
|
|||||||
# 检查全局变量中是否存在
|
# 检查全局变量中是否存在
|
||||||
if class_name not in globals():
|
if class_name not in globals():
|
||||||
# 导入模块,除了插件和Command本身,只有chain能响应事件
|
# 导入模块,除了插件和Command本身,只有chain能响应事件
|
||||||
module = importlib.import_module(
|
try:
|
||||||
f"app.chain.{class_name[:-5].lower()}"
|
module = importlib.import_module(
|
||||||
)
|
f"app.chain.{class_name[:-5].lower()}"
|
||||||
class_obj = getattr(module, class_name)()
|
)
|
||||||
|
class_obj = getattr(module, class_name)()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"事件处理出错:{str(e)} - {traceback.format_exc()}")
|
||||||
|
continue
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# 通过类名创建类实例
|
# 通过类名创建类实例
|
||||||
class_obj = globals()[class_name]()
|
class_obj = globals()[class_name]()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user