exceptions.py 617 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. class RFC3986Exception(Exception):
  3. pass
  4. class InvalidAuthority(RFC3986Exception):
  5. def __init__(self, authority):
  6. super(InvalidAuthority, self).__init__(
  7. "The authority ({0}) is not valid.".format(authority))
  8. class InvalidPort(RFC3986Exception):
  9. def __init__(self, port):
  10. super(InvalidPort, self).__init__(
  11. 'The port ("{0}") is not valid.'.format(port))
  12. class ResolutionError(RFC3986Exception):
  13. def __init__(self, uri):
  14. super(ResolutionError, self).__init__(
  15. "{0} is not an absolute URI.".format(uri.unsplit()))