error.py 643 B

12345678910111213141516171819202122
  1. class FeatureLibError(Exception):
  2. def __init__(self, message, location):
  3. Exception.__init__(self, message)
  4. self.location = location
  5. def __str__(self):
  6. message = Exception.__str__(self)
  7. if self.location:
  8. return f"{self.location}: {message}"
  9. else:
  10. return message
  11. class IncludedFeaNotFound(FeatureLibError):
  12. def __str__(self):
  13. assert self.location is not None
  14. message = (
  15. "The following feature file should be included but cannot be found: "
  16. f"{Exception.__str__(self)}"
  17. )
  18. return f"{self.location}: {message}"