mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-14 15:23:27 +00:00
fixes #13070
This commit is contained in:
@@ -452,8 +452,8 @@ proc raiseExceptionAux(e: sink(ref Exception)) {.nodestroy.} =
|
||||
# XXX This check should likely also be done in the setjmp case below.
|
||||
if e != currException:
|
||||
pushCurrentException(e)
|
||||
when gotoBasedExceptions:
|
||||
inc nimInErrorMode
|
||||
when gotoBasedExceptions:
|
||||
inc nimInErrorMode
|
||||
else:
|
||||
if excHandler != nil:
|
||||
pushCurrentException(e)
|
||||
|
||||
40
tests/destructor/tgotoexceptions4.nim
Normal file
40
tests/destructor/tgotoexceptions4.nim
Normal file
@@ -0,0 +1,40 @@
|
||||
discard """
|
||||
cmd: "nim c --gc:arc --exceptions:goto $file"
|
||||
output: '''caught in gun
|
||||
caught in fun
|
||||
caughtsome msgMyExcept
|
||||
in finally
|
||||
caught1'''
|
||||
"""
|
||||
|
||||
when true:
|
||||
# bug #13070
|
||||
type MyExcept = object of CatchableError
|
||||
proc gun() =
|
||||
try:
|
||||
raise newException(MyExcept, "some msg")
|
||||
except Exception as eab:
|
||||
echo "caught in gun"
|
||||
raise eab
|
||||
|
||||
proc fun() =
|
||||
try:
|
||||
gun()
|
||||
except Exception as e:
|
||||
echo "caught in fun"
|
||||
echo("caught", e.msg, e.name)
|
||||
finally:
|
||||
echo "in finally"
|
||||
fun()
|
||||
|
||||
when true:
|
||||
# bug #13072
|
||||
type MyExceptB = object of CatchableError
|
||||
proc gunB() =
|
||||
raise newException(MyExceptB, "some msg")
|
||||
proc funB() =
|
||||
try:
|
||||
gunB()
|
||||
except CatchableError:
|
||||
echo "caught1"
|
||||
funB()
|
||||
Reference in New Issue
Block a user