mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
* [std/re] make interface consistent * tiny * revert * close #18129 add setCurrentException * changelog entry
This commit is contained in:
@@ -329,7 +329,7 @@
|
||||
|
||||
- Fixed premature garbage collection in asyncdispatch, when a stack trace override is in place.
|
||||
|
||||
|
||||
- Added setCurrentException for JS backend.
|
||||
|
||||
## Language changes
|
||||
|
||||
|
||||
@@ -69,6 +69,9 @@ proc getCurrentExceptionMsg*(): string =
|
||||
return $msg
|
||||
return ""
|
||||
|
||||
proc setCurrentException*(exc: ref Exception) =
|
||||
lastJSError = cast[PJSError](exc)
|
||||
|
||||
proc auxWriteStackTrace(f: PCallFrame): string =
|
||||
type
|
||||
TempFrame = tuple[procname: cstring, line: int, filename: cstring]
|
||||
|
||||
8
tests/exception/tsetexceptions.nim
Normal file
8
tests/exception/tsetexceptions.nim
Normal file
@@ -0,0 +1,8 @@
|
||||
discard """
|
||||
targets: "c cpp js"
|
||||
"""
|
||||
|
||||
let ex = newException(CatchableError, "test")
|
||||
setCurrentException(ex)
|
||||
doAssert getCurrentException().msg == ex.msg
|
||||
doAssert getCurrentExceptionMsg() == ex.msg
|
||||
Reference in New Issue
Block a user