summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-05-16 14:03:33 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-05-16 14:03:33 +0200
commit113857c7f1a6f96665fc9a6948438dfd3166f008 (patch)
tree783820f9fd7bf142a613490c62cfcfa9a9300d1e /lib
parent3afd852f54df2a0bc06be34d06509dfb2b9c80c5 (diff)
downloadNim-113857c7f1a6f96665fc9a6948438dfd3166f008.tar.gz
better stack trace handling
Diffstat (limited to 'lib')
-rw-r--r--lib/system/excpt.nim9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index 8ed1fbb38..096d01845 100644
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -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.} =