From e0c49a1d4a802041ba90fff8bb8d1f991e2fe50f Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Mon, 27 Apr 2020 18:13:18 +0200 Subject: [PATCH] [feaLib] Improve exception message --- Lib/fontTools/feaLib/builder.py | 6 ++++-- Tests/feaLib/builder_test.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Lib/fontTools/feaLib/builder.py b/Lib/fontTools/feaLib/builder.py index 4e7826d01..72156b8bb 100644 --- a/Lib/fontTools/feaLib/builder.py +++ b/Lib/fontTools/feaLib/builder.py @@ -1264,7 +1264,8 @@ class ChainContextPosBuilder(LookupBuilder): for sequenceIndex, l in enumerate(lookups): if l is not None: if l.lookup_index is None: - raise FeatureLibError('Missing lookup index', + raise FeatureLibError('Missing index of the specified ' + 'lookup, might be a substitution lookup', self.location) rec = otTables.PosLookupRecord() rec.SequenceIndex = sequenceIndex @@ -1314,7 +1315,8 @@ class ChainContextSubstBuilder(LookupBuilder): for sequenceIndex, l in enumerate(lookups): if l is not None: if l.lookup_index is None: - raise FeatureLibError('Missing lookup index', + raise FeatureLibError('Missing index of the specified ' + 'lookup, might be a positioning lookup', self.location) rec = otTables.SubstLookupRecord() rec.SequenceIndex = sequenceIndex diff --git a/Tests/feaLib/builder_test.py b/Tests/feaLib/builder_test.py index a90bc91e6..3273ba618 100644 --- a/Tests/feaLib/builder_test.py +++ b/Tests/feaLib/builder_test.py @@ -433,7 +433,7 @@ class BuilderTest(unittest.TestCase): def test_chain_subst_refrences_GPOS_looup(self): self.assertRaisesRegex( FeatureLibError, - "Missing lookup index", + "Missing index of the specified lookup, might be a positioning lookup", self.build, "lookup dummy { pos a 50; } dummy;" "feature test {" @@ -444,7 +444,7 @@ class BuilderTest(unittest.TestCase): def test_chain_pos_refrences_GSUB_looup(self): self.assertRaisesRegex( FeatureLibError, - "Missing lookup index", + "Missing index of the specified lookup, might be a substitution lookup", self.build, "lookup dummy { sub a by A; } dummy;" "feature test {"