mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
This commit is contained in:
@@ -53,7 +53,7 @@ proc isNimException(): bool {.asmNoStackFrame.} =
|
||||
else:
|
||||
asm "return `lastJSError`.m_type;"
|
||||
|
||||
proc getCurrentException*(): ref Exception =
|
||||
proc getCurrentException*(): ref Exception {.compilerRtl, benign.} =
|
||||
if isNimException(): result = cast[ref Exception](lastJSError)
|
||||
|
||||
proc getCurrentExceptionMsg*(): string =
|
||||
|
||||
13
tests/js/ttryexceptnewsyntax.nim
Normal file
13
tests/js/ttryexceptnewsyntax.nim
Normal file
@@ -0,0 +1,13 @@
|
||||
discard """
|
||||
output: '''hello'''
|
||||
"""
|
||||
|
||||
type
|
||||
MyException = ref Exception
|
||||
|
||||
#bug #5986
|
||||
|
||||
try:
|
||||
raise MyException(msg: "hello")
|
||||
except MyException as e:
|
||||
echo e.msg
|
||||
Reference in New Issue
Block a user