Cosimo Lupo 7d7212b01f
feaLib: add IncludedFeaNotFound error
subclass of FeatureLibError, only raised if IOError.errno == ENOENT (i.e. FileNotFoundError)

https://github.com/googlei18n/fontmake/issues/157#issuecomment-367380471

Will be useful in ufo2ft to detect when an included feature file doesn't exist and print a nicer error message
explaining that includes must be relative to the UFO itself, and not relative to the embedded features.fea file.

https://github.com/unified-font-object/ufo-spec/issues/55
2018-02-21 16:41:11 +00:00

21 lines
560 B
Python

from __future__ import print_function, division, absolute_import
from __future__ import unicode_literals
class FeatureLibError(Exception):
def __init__(self, message, location):
Exception.__init__(self, message)
self.location = location
def __str__(self):
message = Exception.__str__(self)
if self.location:
path, line, column = self.location
return "%s:%d:%d: %s" % (path, line, column, message)
else:
return message
class IncludedFeaNotFound(FeatureLibError):
pass