1import traceback 2 3 4class FontBakeryRunnerError(Exception): 5 pass 6 7 8class CircularDependencyError(FontBakeryRunnerError): 9 pass 10 11 12class APIViolationError(FontBakeryRunnerError): 13 def __init__(self, message, result, *args): 14 self.message = message 15 self.result = result 16 super().__init__(message, *args) 17 18 19class ProtocolViolationError(FontBakeryRunnerError): 20 def __init__(self, message, *args): 21 self.message = message 22 super().__init__(message, *args) 23 24 25class FailedCheckError(FontBakeryRunnerError): 26 def __init__(self, error, *args): 27 message = f"Failed with {type(error).__name__}: {error}" 28 self.error = error 29 self.traceback = "".join(traceback.format_tb(error.__traceback__)) 30 super().__init__(message, *args) 31 32 33class FailedConditionError(FontBakeryRunnerError): 34 """This is a serious problem with the check suite profile 35 and it must be solved. 36 """ 37 38 def __init__(self, condition, error, *args): 39 message = ( 40 f"The condition {condition} had an error:" 41 f" {type(error).__name__}: {error}" 42 ) 43 self.condition = condition 44 self.error = error 45 self.traceback = "".join(traceback.format_tb(error.__traceback__)) 46 super().__init__(message, *args) 47 48 49class MissingConditionError(FontBakeryRunnerError): 50 """This is a serious problem with the check suite profile 51 and it must be solved, most probably a typo. 52 """ 53 54 def __init__(self, condition_name, error, *args): 55 message = ( 56 f"The condition named {condition_name} is missing:" 57 f" {type(error).__name__}: {error}" 58 ) 59 self.error = error 60 self.traceback = "".join(traceback.format_tb(error.__traceback__)) 61 super().__init__(message, *args) 62 63 64class FailedDependenciesError(FontBakeryRunnerError): 65 def __init__(self, check, error, *args): 66 message = f"The check {check} had an error:" f" {type(error).__name__}: {error}" 67 self.check = check 68 self.error = error 69 self.traceback = "".join(traceback.format_tb(error.__traceback__)) 70 super().__init__(message, *args) 71 72 73class SetupError(FontBakeryRunnerError): 74 pass 75 76 77class MissingValueError(FontBakeryRunnerError): 78 pass 79 80 81class CircularAliasError(FontBakeryRunnerError): 82 pass 83 84 85class NamespaceError(FontBakeryRunnerError): 86 pass 87 88 89class ValueValidationError(FontBakeryRunnerError): 90 pass 91