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