summary refs log tree commit diff stats
path: root/lib/system/excpt.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-11-05 08:36:44 +0100
committerAraq <rumpf_a@web.de>2012-11-05 08:36:44 +0100
commit865d9cc6e6df872f7fa1a32536a3ae42c0384d51 (patch)
tree97e1c47dbaa15a54c9ab78275a78292bb0688fae /lib/system/excpt.nim
parent42c8fd1fe2e8a045741c18cd02f9410cb7a990f8 (diff)
downloadNim-865d9cc6e6df872f7fa1a32536a3ae42c0384d51.tar.gz
added system.onRaise to support a condition system
Diffstat (limited to 'lib/system/excpt.nim')
-rwxr-xr-xlib/system/excpt.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index fd7557ef0..176395975 100755
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -52,6 +52,7 @@ proc setFrame(s: PFrame) {.compilerRtl, inl.} =
   framePtr = s
 
 proc pushSafePoint(s: PSafePoint) {.compilerRtl, inl.} = 
+  s.raiseAction = nil
   s.prev = excHandler
   excHandler = s
 
@@ -198,8 +199,9 @@ proc raiseExceptionAux(e: ref E_Base) =
   if globalRaiseHook != nil:
     if not globalRaiseHook(e): return
   if excHandler != nil:
-    pushCurrentException(e)
-    c_longjmp(excHandler.context, 1)
+    if isNil(excHandler.raiseAction) or excHandler.raiseAction(e):
+      pushCurrentException(e)
+      c_longjmp(excHandler.context, 1)
   elif e[] of EOutOfMemory:
     writeToStdErr(e.name)
     quitOrDebug()