12345678910111213141516171819202122232425262728293031323334353637 |
- class YbwCrawlError(Exception):
- def __init__(self, *args, **kwargs):
- self.code = kwargs.get('code', 10000)
- self.reason = kwargs.get('reason', '元博网采集未知错误,请手动处理')
- if 'code' not in kwargs:
- kwargs['code'] = self.code
- if 'reason' not in kwargs:
- kwargs['reason'] = self.reason
- [setattr(self, key, val) for key, val in kwargs.items()]
- super(YbwCrawlError, self).__init__(*args, kwargs)
- class AccountError(YbwCrawlError):
- def __init__(self, reason='账号异常', code=10001, **kwargs):
- super(AccountError, self).__init__(code=code, reason=reason, **kwargs)
- class CheckError(YbwCrawlError):
- def __init__(self, reason='数据检查异常', code=10002, **kwargs):
- super(CheckError, self).__init__(code=code, reason=reason, **kwargs)
- class CrawlError(YbwCrawlError):
- def __init__(self, reason='数据采集异常', code=10003, **kwargs):
- super(CrawlError, self).__init__(code=code, reason=reason, **kwargs)
- class AttachmentError(YbwCrawlError):
- def __init__(self, reason='附件异常', code=10004, **kwargs):
- super(AttachmentError, self).__init__(code=code, reason=reason, **kwargs)
|