Source code for ev_error

[docs]class Error(object): # """A class for representing errors that occur in the program. # Args: # _code (int): The error code. # _msg_prefix (str): The prefix for the error message. # _msg (str): The error message. # """ def __init__(self, code, msg_prefix): # """Initialize a new Error instance. # Args: # code (int): The error code. # msg_prefix (str): The prefix for the error message. # """ self._code = code self._msg_prefix = msg_prefix self._msg = '' @property def code(self): # """int: The error code.""" return self._code @code.setter def code(self, code): # """Set the error code. # Args: # code (int): The new error code. # """ self._code = code @property def msg(self): # """str: The full error message, including the prefix and message.""" return self._msg_prefix + ' - ' + self._msg @msg.setter def msg(self, msg): # """Set the error message. # Args: # msg (str): The new error message. # """ self._msg = msg
[docs]class Error_JsonParse(Error): """用于表示程序中发生的JSON解析错误的类。 Args: msg (str, optional): 错误消息。默认为空字符串。 """ def __init__(self, msg=''): # """Initialize a new JsonParseError instance. # Args: # msg (str, optional): The error message. Defaults to an empty # string. # """ super(Error_JsonParse, self).__init__(460, 'Json Parse Error') self.msg = msg
[docs]class Error_InputFormat(Error): """表示程序中发生的输入格式错误的类。 Args: msg (str, optional): 错误消息。默认为空字符串。 """ def __init__(self, msg=''): # """Initialize a new Error_InputFormat instance. # Args: # msg (str, optional): The error message. Defaults to an empty # string. # """ super(Error_InputFormat, self).__init__(460, 'Input Body Format Error') self.msg = msg
[docs]class Error_ImageDecode(Error): """用于表示程序中出现的图像解码错误的类。 Args: msg (str, optional): 错误消息。默认为空字符串。 """ def __init__(self, msg=''): # """Initialize a new Error_ImageDecode instance. # Args: # msg (str, optional): The error message. Defaults to an empty # string. # """ super(Error_ImageDecode, self).__init__(462, 'Image Decode Error') self.msg = msg
[docs]class Error_Import(Error): """表示导入错误的类,env需要修复。 Args: msg (str, optional): The error message. Defaults to an empty string. """ def __init__(self, msg=''): # """Initialize a new Error_Import instance. # Args: # msg (str, optional): The error message. Defaults to an empty # string. # """ super(Error_Import, self).__init__(463, 'Error_Import') self.msg = msg
[docs]class Error_UnExpectedServer(Error): """表示程序中发生的意外错误的类。 Args: msg (str, optional): 错误消息。默认为空字符串。 """ def __init__(self, msg=''): # """Initialize a new Error_UnExpectedServer instance. # Args: # msg (str, optional): The error message. Defaults to an # empty string. # """ super(Error_UnExpectedServer, self).__init__(469, 'Unexpected \ Server Error') self.msg = msg