errors.py 886 B

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