execptions.py 844 B

12345678910111213141516171819202122232425262728
  1. class HostsRetrieveError(Exception):
  2. def __init__(self, *args, **kwargs):
  3. if 'code' not in kwargs and 'reason' not in kwargs:
  4. kwargs['code'] = 10000
  5. kwargs['reason'] = '未知的异常错误,请手动处理'
  6. for key, val in kwargs.items():
  7. setattr(self, key, val)
  8. super(HostsRetrieveError, self).__init__(*args, kwargs)
  9. class ValidatorError(HostsRetrieveError):
  10. def __init__(self, reason, code=10001):
  11. super(ValidatorError, self).__init__(code=code, reason=reason)
  12. class TaskError(HostsRetrieveError):
  13. def __init__(self, reason, code=10002):
  14. super(TaskError, self).__init__(code=code, reason=reason)
  15. class QccError(HostsRetrieveError):
  16. def __init__(self, reason, code=10003):
  17. super(QccError, self).__init__(code=code, reason=reason)