added system.onRaise to support a condition system
This commit is contained in:
parent
42c8fd1fe2
commit
865d9cc6e6
7 changed files with 100 additions and 36 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue