Reset framePtr on unhabdled exception. Dont reset on getStackTrace.

This commit is contained in:
Yuriy Glukhov 2016-08-27 18:10:13 +03:00
commit c1dd65c01a

View file

@ -86,9 +86,6 @@ proc auxWriteStackTrace(f: PCallFrame): string =
proc rawWriteStackTrace(): string = proc rawWriteStackTrace(): string =
if framePtr != nil: if framePtr != nil:
result = "Traceback (most recent call last)\n" & auxWriteStackTrace(framePtr) result = "Traceback (most recent call last)\n" & auxWriteStackTrace(framePtr)
framePtr = nil
elif lastJSError != nil:
result = $lastJSError.stack
else: else:
result = "No stack traceback available\n" result = "No stack traceback available\n"
@ -108,6 +105,7 @@ proc unhandledException(e: ref Exception) {.
when NimStackTrace: when NimStackTrace:
add(buf, rawWriteStackTrace()) add(buf, rawWriteStackTrace())
let cbuf : cstring = buf let cbuf : cstring = buf
framePtr = nil
{.emit: """ {.emit: """
if (typeof(Error) !== "undefined") { if (typeof(Error) !== "undefined") {
throw new Error(`cbuf`); throw new Error(`cbuf`);