123456789101112131415 |
- class PySpiderError(Exception):
- 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(PySpiderError, self).__init__(*args, kwargs)
- class AttachmentNullError(PySpiderError):
- def __init__(self, code: int = 10004, reason: str = '附件下载异常'):
- super(AttachmentNullError, self).__init__(code=code, reason=reason)
|