esp-idf/tools/idf_py_actions/errors.py

21 wiersze
649 B
Python
Czysty Zwykły widok Historia

2022-05-23 13:30:13 +00:00
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
2022-06-03 12:46:56 +00:00
from click.core import Context
class FatalError(RuntimeError):
"""
Wrapper class for runtime errors that aren't caused by bugs in idf.py or the build process.
"""
2022-06-03 12:46:56 +00:00
def __init__(self, message: str, ctx: Context=None):
super(RuntimeError, self).__init__(message)
# if context is defined, check for the cleanup tasks
if ctx is not None and 'cleanup' in ctx.meta:
# cleans up the environment before failure
ctx.meta['cleanup']()
class NoSerialPortFoundError(FatalError):
pass