execptions.py 944 B

12345678910111213141516171819202122232425262728293031
  1. class ExploreDataError(Exception):
  2. def __init__(self, *args, **kwargs):
  3. self.code = kwargs.get('code', 10000)
  4. self.reason = kwargs.get('reason', '未知的数据挖掘错误,请尽快处理')
  5. if 'code' not in kwargs:
  6. kwargs['code'] = self.code
  7. if 'reason' not in kwargs:
  8. kwargs['reason'] = self.reason
  9. [setattr(self, key, val) for key, val in kwargs.items()]
  10. super(ExploreDataError, self).__init__(*args, kwargs)
  11. class ValidatorError(ExploreDataError):
  12. def __init__(self, reason, code=10001):
  13. super(ValidatorError, self).__init__(code=code, reason=reason)
  14. class TaskError(ExploreDataError):
  15. def __init__(self, reason, code=10002):
  16. super(TaskError, self).__init__(code=code, reason=reason)
  17. class QccError(ExploreDataError):
  18. def __init__(self, reason, code=10003):
  19. super(QccError, self).__init__(code=code, reason=reason)