error.py 789 B

123456789101112131415161718192021222324252627282930313233
  1. """
  2. -------------------------------------------------
  3. File Name: error.py
  4. Description: 异常模块
  5. Author: Liu
  6. Date: 2016/12/9
  7. -------------------------------------------------
  8. """
  9. class ResourceDepletionError(Exception):
  10. """
  11. 资源枯竭异常,如果从所有抓取网站都抓不到可用的代理资源,
  12. 则抛出此异常。
  13. """
  14. def __init__(self):
  15. Exception.__init__(self)
  16. def __str__(self):
  17. return repr('The proxy source is exhausted')
  18. class PoolEmptyError(Exception):
  19. """
  20. 代理池空异常,如果代理池长时间为空,则抛出此异常。
  21. """
  22. def __init__(self):
  23. Exception.__init__(self)
  24. def __str__(self):
  25. return repr('The proxy pool is empty')