error.py 954 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # All exceptions raised here derive from HttpLib2Error
  2. class HttpLib2Error(Exception):
  3. pass
  4. # Some exceptions can be caught and optionally
  5. # be turned back into responses.
  6. class HttpLib2ErrorWithResponse(HttpLib2Error):
  7. def __init__(self, desc, response, content):
  8. self.response = response
  9. self.content = content
  10. HttpLib2Error.__init__(self, desc)
  11. class RedirectMissingLocation(HttpLib2ErrorWithResponse):
  12. pass
  13. class RedirectLimit(HttpLib2ErrorWithResponse):
  14. pass
  15. class FailedToDecompressContent(HttpLib2ErrorWithResponse):
  16. pass
  17. class UnimplementedDigestAuthOptionError(HttpLib2ErrorWithResponse):
  18. pass
  19. class UnimplementedHmacDigestAuthOptionError(HttpLib2ErrorWithResponse):
  20. pass
  21. class MalformedHeader(HttpLib2Error):
  22. pass
  23. class RelativeURIError(HttpLib2Error):
  24. pass
  25. class ServerNotFoundError(HttpLib2Error):
  26. pass
  27. class ProxiesUnavailableError(HttpLib2Error):
  28. pass