This commit is contained in:
flywind 2021-01-04 11:27:58 -06:00 • committed by GitHub
commit 9531afac48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View file

@ -30,16 +30,20 @@ elif (defined(nimQuirky) or defined(nimPanics)) and not defined(nimscript):
proc name(t: typedesc): string {.magic: "TypeTrait".}
proc sysFatal(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
writeStackTrace()
var buf = newStringOfCap(200)
add(buf, "Error: unhandled exception: ")
add(buf, message)
add(buf, arg)
add(buf, " [")
add(buf, name exceptn)
add(buf, "]\n")
cstderr.rawWrite buf
quit 1
when nimvm:
# TODO when doAssertRaises works in CT, add a test for it
raise (ref exceptn)(msg: message & arg)
else:
writeStackTrace()
var buf = newStringOfCap(200)
add(buf, "Error: unhandled exception: ")
add(buf, message)
add(buf, arg)
add(buf, " [")
add(buf, name exceptn)
add(buf, "]\n")
cstderr.rawWrite buf
quit 1
proc sysFatal(exceptn: typedesc, message: string) {.inline, noreturn.} =
sysFatal(exceptn, message, "")