1
0

errors.py 967 B

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