errors.py 602 B

1234567891011121314151617
  1. # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: Apache-2.0
  3. class FatalError(RuntimeError):
  4. """
  5. Wrapper class for runtime errors that aren't caused by bugs in idf.py or the build process.
  6. """
  7. def __init__(self, message, ctx=None):
  8. super(RuntimeError, self).__init__(message)
  9. # if context is defined, check for the cleanup tasks
  10. if ctx is not None and 'cleanup' in ctx.meta:
  11. # cleans up the environment before failure
  12. ctx.meta['cleanup']()
  13. class NoSerialPortFoundError(FatalError):
  14. pass