errors.py 832 B

12345678910111213141516171819202122232425262728
  1. class ConfigurationError(Exception):
  2. def __init__(self, msg):
  3. self.msg = msg
  4. def __str__(self):
  5. return self.msg
  6. class CircularReference(ConfigurationError):
  7. def __init__(self, trail):
  8. self.trail = trail
  9. @property
  10. def msg(self):
  11. lines = [
  12. "{} in {}".format(service_name, filename)
  13. for (filename, service_name) in self.trail
  14. ]
  15. return "Circular reference:\n {}".format("\n extends ".join(lines))
  16. class ComposeFileNotFound(ConfigurationError):
  17. def __init__(self, supported_filenames):
  18. super(ComposeFileNotFound, self).__init__("""
  19. Can't find a suitable configuration file in this directory or any parent. Are you in the right directory?
  20. Supported filenames: %s
  21. """ % ", ".join(supported_filenames))