exceptions.py 552 B

1234567891011121314151617181920212223242526
  1. class Error(Exception):
  2. def __init__(self, message=None):
  3. super(Error, self).__init__(message)
  4. class PermissionError(Error):
  5. pass
  6. class NotFoundError(Error):
  7. pass
  8. class InvalidInput(Error):
  9. pass
  10. class ArbitraryError(Error):
  11. def __init__(self, response):
  12. text = response.text[:46] + ' ...' if len(response.text) > 50 else response.text
  13. message = 'http_status="{}" response="{}"'.format(response.status_code, text)
  14. super(ArbitraryError, self).__init__(message)
  15. class Timeout(Error):
  16. pass