xref: /aosp_15_r20/external/fonttools/Lib/fontTools/otlLib/error.py (revision e1fe3e4ad2793916b15cccdc4a7da52a7e1dd0e9)
1*e1fe3e4aSElliott Hughesclass OpenTypeLibError(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