better stack trace handling

This commit is contained in:
Andreas Rumpf
2017-05-16 14:03:33 +02:00
parent 3afd852f54
commit 113857c7f1

View File

@@ -282,8 +282,13 @@ proc raiseExceptionAux(e: ref Exception) =
proc raiseException(e: ref Exception, ename: cstring) {.compilerRtl.} =
if e.name.isNil: e.name = ename
when hasSomeStackTrace:
e.trace = ""
rawWriteStackTrace(e.trace)
if e.trace.isNil:
e.trace = ""
rawWriteStackTrace(e.trace)
elif framePtr != nil:
e.trace.add "[[reraised from:\n"
auxWriteStackTrace(framePtr, e.trace)
e.trace.add "]]\n"
raiseExceptionAux(e)
proc reraiseException() {.compilerRtl.} =