#!/usr/bin/env python3 import esp32utils class FatalError(RuntimeError): def __init__(self, message): RuntimeError.__init__(self, message) @staticmethod def WithResult(message, result): message += " (result was %s)" % esp32utils.hexify(result) return FatalError(message) class NotImplementedInROMError(FatalError): def __init__(self, bootloader, func): FatalError.__init__(self, "%s ROM does not support function %s." % (bootloader.CHIP_NAME, func.__name__)) class NotSupportedError(FatalError): def __init__(self, esp, function_name): FatalError.__init__(self, "Function %s is not supported for %s." % (function_name, esp.CHIP_NAME)) class InputError(RuntimeError): def __init__(self, e): super(InputError, self).__init__(e) class ValidationError(InputError): def __init__(self, partition, message): super(ValidationError, self).__init__( "Partition %s invalid: %s" % (partition.name, message))