errors.py 897 B

12345678910111213141516171819202122232425262728
  1. #
  2. # This file is part of gunicorn released under the MIT license.
  3. # See the NOTICE for more information.
  4. # We don't need to call super() in __init__ methods of our
  5. # BaseException and Exception classes because we also define
  6. # our own __str__ methods so there is no need to pass 'message'
  7. # to the base class to get a meaningful output from 'str(exc)'.
  8. # pylint: disable=super-init-not-called
  9. # we inherit from BaseException here to make sure to not be caught
  10. # at application level
  11. class HaltServer(BaseException):
  12. def __init__(self, reason, exit_status=1):
  13. self.reason = reason
  14. self.exit_status = exit_status
  15. def __str__(self):
  16. return "<HaltServer %r %d>" % (self.reason, self.exit_status)
  17. class ConfigError(Exception):
  18. """ Exception raised on config error """
  19. class AppImportError(Exception):
  20. """ Exception raised when loading an application """