1# vim: set syntax=python ts=4 : 2# 3# Copyright (c) 2018-2022 Intel Corporation 4# SPDX-License-Identifier: Apache-2.0 5import logging 6import traceback 7 8logger = logging.getLogger('twister') 9logger.setLevel(logging.DEBUG) 10 11class TwisterException(Exception): 12 def __init__(self, message="TwisterException"): 13 super().__init__(message) 14 logger.error(''.join(["Twister call stack dump:\n"] + traceback.format_stack()[:-1])) 15 16class TwisterRuntimeError(TwisterException): 17 pass 18 19class ConfigurationError(TwisterException): 20 def __init__(self, cfile, message): 21 TwisterException.__init__(self, str(cfile) + ": " + message) 22 23class BuildError(TwisterException): 24 pass 25 26class ExecutionError(TwisterException): 27 pass 28 29class StatusAttributeError(TwisterException): 30 def __init__(self, cls : type, value): 31 msg = f'{cls.__name__} assigned status {value}, which could not be cast to a TwisterStatus.' 32 super().__init__(msg) 33