summary refs log tree commit diff stats
path: root/lib/system/fatal.nim
diff options
context:
space:
mode:
authorJacek Sieka <arnetheduck@gmail.com>2023-11-06 07:57:29 +0100
committerGitHub <noreply@github.com>2023-11-06 07:57:29 +0100
commit58c44312afba755f73ba2ec7ab73daea7768e41d (patch)
tree0d77c592788948cdd2f9ac438b406cdc84479f2c /lib/system/fatal.nim
parenteb8824d71cb36be8a9558bf572606a24825bb33b (diff)
downloadNim-58c44312afba755f73ba2ec7ab73daea7768e41d.tar.gz
reserve `sysFatal` for `Defect` (#22158)
Per manual, `panics:on` affects _only_ `Defect`:s - thus `sysFatal`
should not redirect any other exceptions.

Also, when `sysFatal` is used in `nimPanics` mode, it should use regular
exception handling pipeline to ensure exception hooks are called
consistently for all raised defects.
Diffstat (limited to 'lib/system/fatal.nim')
-rw-r--r--lib/system/fatal.nim14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/system/fatal.nim b/lib/system/fatal.nim
index f1f94d078..25c05e52d 100644
--- a/lib/system/fatal.nim
+++ b/lib/system/fatal.nim
@@ -16,19 +16,19 @@ const
 when hostOS == "standalone":
   include "$projectpath/panicoverride"
 
-  func sysFatal(exceptn: typedesc, message: string) {.inline.} =
+  func sysFatal(exceptn: typedesc[Defect], message: string) {.inline.} =
     panic(message)
 
-  func sysFatal(exceptn: typedesc, message, arg: string) {.inline.} =
+  func sysFatal(exceptn: typedesc[Defect], message, arg: string) {.inline.} =
     rawoutput(message)
     panic(arg)
 
-elif (quirkyExceptions or defined(nimPanics)) and not defined(nimscript):
+elif quirkyExceptions and not defined(nimscript):
   import ansi_c
 
   func name(t: typedesc): string {.magic: "TypeTrait".}
 
-  func sysFatal(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
+  func sysFatal(exceptn: typedesc[Defect], message, arg: string) {.inline, noreturn.} =
     when nimvm:
       # TODO when doAssertRaises works in CT, add a test for it
       raise (ref exceptn)(msg: message & arg)
@@ -45,14 +45,14 @@ elif (quirkyExceptions or defined(nimPanics)) and not defined(nimscript):
         cstderr.rawWrite buf
       rawQuit 1
 
-  func sysFatal(exceptn: typedesc, message: string) {.inline, noreturn.} =
+  func sysFatal(exceptn: typedesc[Defect], message: string) {.inline, noreturn.} =
     sysFatal(exceptn, message, "")
 
 else:
-  func sysFatal(exceptn: typedesc, message: string) {.inline, noreturn.} =
+  func sysFatal(exceptn: typedesc[Defect], message: string) {.inline, noreturn.} =
     raise (ref exceptn)(msg: message)
 
-  func sysFatal(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
+  func sysFatal(exceptn: typedesc[Defect], message, arg: string) {.inline, noreturn.} =
     raise (ref exceptn)(msg: message & arg)
 
 {.pop.}