better stack trace handling

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

View file

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