do not track 'raise Defect' in the .raises: [] clause anymore (#14298)
* do not track 'raise Defect' in the .raises: [] clause anymore * --panics:on maps 'raise Defect' to an unrecoverable fatal error * make tests green again * update the documentation too
This commit is contained in:
parent
517dd800f8
commit
03c146cd93
6 changed files with 74 additions and 8 deletions
|
|
@ -406,7 +406,7 @@ proc reportUnhandledError(e: ref Exception) {.nodestroy.} =
|
|||
when hostOS != "any":
|
||||
reportUnhandledErrorAux(e)
|
||||
else:
|
||||
discard()
|
||||
discard ()
|
||||
|
||||
proc nimLeaveFinally() {.compilerRtl.} =
|
||||
when defined(cpp) and not defined(noCppExceptions) and not gotoBasedExceptions:
|
||||
|
|
@ -434,6 +434,11 @@ when gotoBasedExceptions:
|
|||
quit(1)
|
||||
|
||||
proc raiseExceptionAux(e: sink(ref Exception)) {.nodestroy.} =
|
||||
when defined(nimPanics):
|
||||
if e of Defect:
|
||||
reportUnhandledError(e)
|
||||
quit(1)
|
||||
|
||||
if localRaiseHook != nil:
|
||||
if not localRaiseHook(e): return
|
||||
if globalRaiseHook != nil:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue