errors.py 584 B

12345678910111213141516171819202122
  1. from __future__ import annotations
  2. class UFOLibError(Exception):
  3. pass
  4. class UnsupportedUFOFormat(UFOLibError):
  5. pass
  6. class GlifLibError(UFOLibError):
  7. def _add_note(self, note: str) -> None:
  8. # Loose backport of PEP 678 until we only support Python 3.11+, used for
  9. # adding additional context to errors.
  10. # TODO: Replace with https://docs.python.org/3.11/library/exceptions.html#BaseException.add_note
  11. (message, *rest) = self.args
  12. self.args = ((message + "\n" + note), *rest)
  13. class UnsupportedGLIFFormat(GlifLibError):
  14. pass