|
@@ -1,19 +1,22 @@
|
|
|
|
|
|
-class JyException(Exception):
|
|
|
+class HostsRetrieveError(Exception):
|
|
|
|
|
|
- def __init__(self, code: int, reason: str, **kwargs):
|
|
|
- self.code = code
|
|
|
- self.reason = reason
|
|
|
- self.err_details = kwargs
|
|
|
+ def __init__(self, *args, **kwargs):
|
|
|
+ if 'code' not in kwargs and 'reason' not in kwargs:
|
|
|
+ kwargs['code'] = 10000
|
|
|
+ kwargs['reason'] = '未知的异常错误,请手动处理'
|
|
|
for key, val in kwargs.items():
|
|
|
setattr(self, key, val)
|
|
|
+ super(HostsRetrieveError, self).__init__(*args, kwargs)
|
|
|
|
|
|
|
|
|
-class VerifyException(JyException):
|
|
|
+class ValidatorError(HostsRetrieveError):
|
|
|
|
|
|
- def __init__(self, code: int = 10001, reason: str = '特征检验错误', **kwargs):
|
|
|
- self.code = code
|
|
|
- self.reason = reason
|
|
|
- self.err_details = kwargs
|
|
|
- for key, val in kwargs.items():
|
|
|
- setattr(self, key, val)
|
|
|
+ def __init__(self, reason, code=10001):
|
|
|
+ super(ValidatorError, self).__init__(code=code, reason=reason)
|
|
|
+
|
|
|
+
|
|
|
+class TaskError(HostsRetrieveError):
|
|
|
+
|
|
|
+ def __init__(self, reason, code=10002):
|
|
|
+ super(TaskError, self).__init__(code=code, reason=reason)
|