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:
Andreas Rumpf 2020-05-11 16:25:56 +02:00 • committed by GitHub
commit 03c146cd93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 74 additions and 8 deletions

View file

@ -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: