errors.py 919 B

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