Skip to content

Commit 661f146

Browse files
committed
better debugging support
1 parent 8e68231 commit 661f146

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/code/wypp/exceptionHandler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ def handleCurrentException(exit=True, removeFirstTb=False, file=sys.stderr):
4343
frameList = (stacktrace.tbToFrameList(tb) if tb is not None else [])
4444
if frameList and removeFirstTb:
4545
frameList = frameList[1:]
46-
isBug = not isWyppError and not isinstance(val, SyntaxError) and \
47-
len(frameList) > 0 and stacktrace.isWyppFrame(frameList[-1])
46+
isSyntaxError = isinstance(val, SyntaxError)
47+
lastFrameIsWypp = len(frameList) > 0 and stacktrace.isWyppFrame(frameList[-1])
48+
isBug = not isWyppError and not isSyntaxError and lastFrameIsWypp
4849
stackSummary = stacktrace.limitTraceback(frameList, extra, not isBug and not isDebug())
4950
header = False
5051
for x in stackSummary.format():
@@ -62,6 +63,7 @@ def handleCurrentException(exit=True, removeFirstTb=False, file=sys.stderr):
6263
for x in traceback.format_exception_only(etype, val):
6364
file.write(x)
6465
if isBug:
66+
debug(f'isWyppError={isWyppError}, isSyntaxError={isSyntaxError}, lastFrameIsWypp={lastFrameIsWypp}')
6567
file.write(f'BUG: the error above is most likely a bug in WYPP!')
6668
if exit:
6769
utils.die(1)

0 commit comments

Comments
 (0)