errors.py 497 B

123456789101112131415
  1. class FatalError(RuntimeError):
  2. """
  3. Wrapper class for runtime errors that aren't caused by bugs in idf.py or the build process.
  4. """
  5. def __init__(self, message, ctx=None):
  6. super(RuntimeError, self).__init__(message)
  7. # if context is defined, check for the cleanup tasks
  8. if ctx is not None and 'cleanup' in ctx.meta:
  9. # cleans up the environment before failure
  10. ctx.meta['cleanup']()
  11. class NoSerialPortFoundError(FatalError):
  12. pass