diff options
author | Andrii Riabushenko <cdome@bk.ru> | 2019-04-30 21:46:45 +0100 |
---|---|---|
committer | Andrii Riabushenko <cdome@bk.ru> | 2019-04-30 21:46:45 +0100 |
commit | 7cfc7cfb26c16c5af4710a653bddbf7e9df1cc25 (patch) | |
tree | 0ba5dd27be1fdb93adb9bc6387056dd0d11ea284 /lib | |
parent | 3d0190f470d345eafca5260bb0e350d062edffcd (diff) | |
download | Nim-7cfc7cfb26c16c5af4710a653bddbf7e9df1cc25.tar.gz |
fixes #11118
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/excpt.nim | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index b421d9650..c27169be7 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -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: |