parent
52e276c82d
commit
916d0c21af
2 changed files with 18 additions and 4 deletions
|
|
@ -524,10 +524,7 @@ proc getStackTrace(e: ref Exception): string =
|
||||||
proc getStackTraceEntries*(e: ref Exception): seq[StackTraceEntry] =
|
proc getStackTraceEntries*(e: ref Exception): seq[StackTraceEntry] =
|
||||||
## Returns the attached stack trace to the exception `e` as
|
## Returns the attached stack trace to the exception `e` as
|
||||||
## a `seq`. This is not yet available for the JS backend.
|
## a `seq`. This is not yet available for the JS backend.
|
||||||
when not defined(nimSeqsV2):
|
shallowCopy(result, e.trace)
|
||||||
shallowCopy(result, e.trace)
|
|
||||||
else:
|
|
||||||
result = move(e.trace)
|
|
||||||
|
|
||||||
proc getStackTraceEntries*(): seq[StackTraceEntry] =
|
proc getStackTraceEntries*(): seq[StackTraceEntry] =
|
||||||
## Returns the stack trace entries for the current stack trace.
|
## Returns the stack trace entries for the current stack trace.
|
||||||
|
|
|
||||||
17
tests/exception/t18620.nim
Normal file
17
tests/exception/t18620.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
discard """
|
||||||
|
matrix: "--gc:arc; --gc:refc"
|
||||||
|
"""
|
||||||
|
|
||||||
|
proc hello() =
|
||||||
|
raise newException(ValueError, "You are wrong")
|
||||||
|
|
||||||
|
var flag = false
|
||||||
|
|
||||||
|
try:
|
||||||
|
hello()
|
||||||
|
except ValueError as e:
|
||||||
|
flag = true
|
||||||
|
doAssert len(getStackTraceEntries(e)) > 0
|
||||||
|
doAssert len(getStackTraceEntries(e)) > 0
|
||||||
|
|
||||||
|
doAssert flag
|
||||||
Loading…
Add table
Add a link
Reference in a new issue