mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes #11118
This commit is contained in:
@@ -342,12 +342,15 @@ proc raiseExceptionAux(e: ref Exception) =
|
||||
if globalRaiseHook != nil:
|
||||
if not globalRaiseHook(e): return
|
||||
when defined(cpp) and not defined(noCppExceptions):
|
||||
pushCurrentException(e)
|
||||
raiseCounter.inc
|
||||
if raiseCounter == 0:
|
||||
raiseCounter.inc # skip zero at overflow
|
||||
e.raiseId = raiseCounter
|
||||
{.emit: "`e`->raise();".}
|
||||
if e == currException:
|
||||
{.emit: "throw;".}
|
||||
else:
|
||||
pushCurrentException(e)
|
||||
raiseCounter.inc
|
||||
if raiseCounter == 0:
|
||||
raiseCounter.inc # skip zero at overflow
|
||||
e.raiseId = raiseCounter
|
||||
{.emit: "`e`->raise();".}
|
||||
elif defined(nimQuirky):
|
||||
pushCurrentException(e)
|
||||
else:
|
||||
|
||||
@@ -5,6 +5,9 @@ bar
|
||||
Need odd and >= 3 digits##
|
||||
baz
|
||||
caught
|
||||
--------
|
||||
Triggered raises2
|
||||
Raising ValueError
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -45,3 +48,24 @@ try:
|
||||
finally:
|
||||
for foobar in strs:
|
||||
discard
|
||||
|
||||
|
||||
# issue #11118
|
||||
echo "--------"
|
||||
proc raises() =
|
||||
raise newException(ValueError, "Raising ValueError")
|
||||
|
||||
proc raises2() =
|
||||
try:
|
||||
raises()
|
||||
except ValueError as e:
|
||||
echo "Triggered raises2"
|
||||
raise e
|
||||
|
||||
try:
|
||||
raises2()
|
||||
except:
|
||||
echo getCurrentExceptionMsg()
|
||||
discard
|
||||
|
||||
doAssert: getCurrentException() == nil
|
||||
Reference in New Issue
Block a user