mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-30 17:15:08 +08:00
🐛 修复异常在 traceback 中无法正常显示信息 (#1521)
This commit is contained in:
parent
f0bebb65b4
commit
9b3e670cee
@ -37,6 +37,9 @@ from pydantic.fields import ModelField
|
||||
class NoneBotException(Exception):
|
||||
"""所有 NoneBot 发生的异常基类。"""
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.__repr__()
|
||||
|
||||
|
||||
# Rule Exception
|
||||
class ParserExit(NoneBotException):
|
||||
@ -53,9 +56,6 @@ class ParserExit(NoneBotException):
|
||||
+ ")"
|
||||
)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.__repr__()
|
||||
|
||||
|
||||
# Processor Exception
|
||||
class ProcessException(NoneBotException):
|
||||
@ -75,9 +75,6 @@ class IgnoredException(ProcessException):
|
||||
def __repr__(self) -> str:
|
||||
return f"IgnoredException(reason={self.reason!r})"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.__repr__()
|
||||
|
||||
|
||||
class SkippedException(ProcessException):
|
||||
"""指示 NoneBot 立即结束当前 `Dependent` 的运行。
|
||||
@ -109,9 +106,6 @@ class TypeMisMatch(SkippedException):
|
||||
f"type={self.param._type_display()}, value={self.value!r}>"
|
||||
)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.__repr__()
|
||||
|
||||
|
||||
class MockApiException(ProcessException):
|
||||
"""指示 NoneBot 阻止本次 API 调用或修改本次调用返回值,并返回自定义内容。可由 api hook 抛出。
|
||||
@ -126,9 +120,6 @@ class MockApiException(ProcessException):
|
||||
def __repr__(self) -> str:
|
||||
return f"MockApiException(result={self.result!r})"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.__repr__()
|
||||
|
||||
|
||||
class StopPropagation(ProcessException):
|
||||
"""指示 NoneBot 终止事件向下层传播。
|
||||
@ -244,6 +235,3 @@ class WebSocketClosed(DriverException):
|
||||
+ (f", reason={self.reason!r}" if self.reason else "")
|
||||
+ ")"
|
||||
)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.__repr__()
|
||||
|
Loading…
Reference in New Issue
Block a user