Skip to content

Commit

Permalink
twister: add trace print in exception
Browse files Browse the repository at this point in the history
add trace print when exception happens

Signed-off-by: Hake Huang <[email protected]>
  • Loading branch information
hakehuang committed Nov 21, 2024
1 parent 2147577 commit 557f4ab
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/pylib/twister/twisterlib/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,32 @@
#
# Copyright (c) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging
import traceback

class TwisterException(Exception):
pass
logger = logging.getLogger('twister')
logger.setLevel(logging.DEBUG)

class TwisterException(Exception):
def __init__(self, message="TwisterException"):
super().__init__(message)
for line in traceback.format_stack():
logger.info(line.strip())
logger.warning("======call stack dump end============")

class TwisterRuntimeError(TwisterException):
pass


class ConfigurationError(TwisterException):
def __init__(self, cfile, message):
TwisterException.__init__(self, str(cfile) + ": " + message)


class BuildError(TwisterException):
pass


class ExecutionError(TwisterException):
pass


class StatusAttributeError(TwisterException):
def __init__(self, cls : type, value):
msg = f'{cls.__name__} assigned status {value}, which could not be cast to a TwisterStatus.'
Expand Down

0 comments on commit 557f4ab

Please sign in to comment.