diff options
author | Yuriy Glukhov <yuriy.glukhov@gmail.com> | 2019-08-16 10:25:09 +0200 |
---|---|---|
committer | Yuriy Glukhov <yuriy.glukhov@gmail.com> | 2019-08-16 10:25:09 +0200 |
commit | d31404ac27503e87ae82544d7efa984f565199f7 (patch) | |
tree | be1bdc3a4ccae047ed216d4200caf1053b0af21e /lib/system | |
parent | 922e2a5098cfec871a9bed7bff6b1e5298c9f931 (diff) | |
parent | 7cfc7cfb26c16c5af4710a653bddbf7e9df1cc25 (diff) | |
download | Nim-d31404ac27503e87ae82544d7efa984f565199f7.tar.gz |
Merge branch 'cpp_reraise_fix' into yield-in-try-fix
Diffstat (limited to 'lib/system')
-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 2a925fd29..767cf3d0d 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: |