diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-09-04 22:48:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-04 22:48:15 +0200 |
commit | e6e53549fe2d7347ddbc97fdce2a83a08fa9ca44 (patch) | |
tree | 8b071485a95b2ffbf059454e34d7b3062485fd56 | |
parent | dfa0699e732619fc2e47aa8ad6990296d93e67b9 (diff) | |
parent | 99bbda28ee728aea14636010721e7a4acc55bb4a (diff) | |
download | Nim-e6e53549fe2d7347ddbc97fdce2a83a08fa9ca44.tar.gz |
Merge pull request #4710 from yglukhov/js-ex-stack
Store stack trace in exception
-rw-r--r-- | lib/system/jssys.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim index 31d283cd7..39ce1183b 100644 --- a/lib/system/jssys.nim +++ b/lib/system/jssys.nim @@ -109,6 +109,7 @@ proc rawWriteStackTrace(): string = result = "No stack traceback available\n" proc getStackTrace*(): string = rawWriteStackTrace() +proc getStackTrace*(e: ref Exception): string = e.trace proc unhandledException(e: ref Exception) {. compilerproc, asmNoStackFrame.} = @@ -142,6 +143,8 @@ proc raiseException(e: ref Exception, ename: cstring) {. when defined(nimphp): asm """throw new Exception($`e`["message"]);""" else: + when NimStackTrace: + e.trace = rawWriteStackTrace() asm "throw `e`;" proc reraiseException() {.compilerproc, asmNoStackFrame.} = |