execptions.py 833 B

123456789101112131415161718192021222324252627
  1. class ExploreDataError(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(ExploreDataError, self).__init__(*args, kwargs)
  9. class ValidatorError(ExploreDataError):
  10. def __init__(self, reason, code=10001):
  11. super(ValidatorError, self).__init__(code=code, reason=reason)
  12. class TaskError(ExploreDataError):
  13. def __init__(self, reason, code=10002):
  14. super(TaskError, self).__init__(code=code, reason=reason)
  15. class QccError(ExploreDataError):
  16. def __init__(self, reason, code=10003):
  17. super(QccError, self).__init__(code=code, reason=reason)