1*e1fe3e4aSElliott Hughesclass FeatureLibError(Exception): 2*e1fe3e4aSElliott Hughes def __init__(self, message, location): 3*e1fe3e4aSElliott Hughes Exception.__init__(self, message) 4*e1fe3e4aSElliott Hughes self.location = location 5*e1fe3e4aSElliott Hughes 6*e1fe3e4aSElliott Hughes def __str__(self): 7*e1fe3e4aSElliott Hughes message = Exception.__str__(self) 8*e1fe3e4aSElliott Hughes if self.location: 9*e1fe3e4aSElliott Hughes return f"{self.location}: {message}" 10*e1fe3e4aSElliott Hughes else: 11*e1fe3e4aSElliott Hughes return message 12*e1fe3e4aSElliott Hughes 13*e1fe3e4aSElliott Hughes 14*e1fe3e4aSElliott Hughesclass IncludedFeaNotFound(FeatureLibError): 15*e1fe3e4aSElliott Hughes def __str__(self): 16*e1fe3e4aSElliott Hughes assert self.location is not None 17*e1fe3e4aSElliott Hughes 18*e1fe3e4aSElliott Hughes message = ( 19*e1fe3e4aSElliott Hughes "The following feature file should be included but cannot be found: " 20*e1fe3e4aSElliott Hughes f"{Exception.__str__(self)}" 21*e1fe3e4aSElliott Hughes ) 22*e1fe3e4aSElliott Hughes return f"{self.location}: {message}" 23