Store stack trace in exception
This commit is contained in:
parent
7e86ed00ce
commit
99bbda28ee
1 changed files with 3 additions and 0 deletions
|
|
@ -109,6 +109,7 @@ proc rawWriteStackTrace(): string =
|
||||||
result = "No stack traceback available\n"
|
result = "No stack traceback available\n"
|
||||||
|
|
||||||
proc getStackTrace*(): string = rawWriteStackTrace()
|
proc getStackTrace*(): string = rawWriteStackTrace()
|
||||||
|
proc getStackTrace*(e: ref Exception): string = e.trace
|
||||||
|
|
||||||
proc unhandledException(e: ref Exception) {.
|
proc unhandledException(e: ref Exception) {.
|
||||||
compilerproc, asmNoStackFrame.} =
|
compilerproc, asmNoStackFrame.} =
|
||||||
|
|
@ -142,6 +143,8 @@ proc raiseException(e: ref Exception, ename: cstring) {.
|
||||||
when defined(nimphp):
|
when defined(nimphp):
|
||||||
asm """throw new Exception($`e`["message"]);"""
|
asm """throw new Exception($`e`["message"]);"""
|
||||||
else:
|
else:
|
||||||
|
when NimStackTrace:
|
||||||
|
e.trace = rawWriteStackTrace()
|
||||||
asm "throw `e`;"
|
asm "throw `e`;"
|
||||||
|
|
||||||
proc reraiseException() {.compilerproc, asmNoStackFrame.} =
|
proc reraiseException() {.compilerproc, asmNoStackFrame.} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue