aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/ufoLib/errors.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/fontTools/ufoLib/errors.py')
-rw-r--r--Lib/fontTools/ufoLib/errors.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/fontTools/ufoLib/errors.py b/Lib/fontTools/ufoLib/errors.py
index 304345e4..e05dd438 100644
--- a/Lib/fontTools/ufoLib/errors.py
+++ b/Lib/fontTools/ufoLib/errors.py
@@ -1,3 +1,4 @@
+from __future__ import annotations
class UFOLibError(Exception):
@@ -9,7 +10,12 @@ class UnsupportedUFOFormat(UFOLibError):
class GlifLibError(UFOLibError):
- pass
+ def _add_note(self, note: str) -> None:
+ # Loose backport of PEP 678 until we only support Python 3.11+, used for
+ # adding additional context to errors.
+ # TODO: Replace with https://docs.python.org/3.11/library/exceptions.html#BaseException.add_note
+ (message, *rest) = self.args
+ self.args = ((message + "\n" + note), *rest)
class UnsupportedGLIFFormat(GlifLibError):