QChatGPT/pkg/command/errors.py

34 lines
751 B
Python
Raw Normal View History

2024-01-28 00:16:42 +08:00
class CommandError(Exception):
2024-01-28 18:21:43 +08:00
def __init__(self, message: str = None):
self.message = message
def __str__(self):
return self.message
2024-01-28 00:16:42 +08:00
class CommandNotFoundError(CommandError):
2024-01-28 18:21:43 +08:00
def __init__(self, message: str = None):
super().__init__("未知命令: "+message)
2024-01-28 00:16:42 +08:00
class CommandPrivilegeError(CommandError):
2024-01-28 18:21:43 +08:00
def __init__(self, message: str = None):
super().__init__("权限不足: "+message)
class ParamNotEnoughError(CommandError):
def __init__(self, message: str = None):
super().__init__("参数不足: "+message)
class CommandOperationError(CommandError):
def __init__(self, message: str = None):
super().__init__("操作失败: "+message)