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