From f6faf029cde9e179cd66dd354c562593ec247a93 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Wed, 20 Nov 2024 15:21:05 +0100 Subject: [PATCH] add an overridable panic handler --- spl/std.spl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spl/std.spl b/spl/std.spl index 152633f..06a9215 100644 --- a/spl/std.spl +++ b/spl/std.spl @@ -559,6 +559,8 @@ func cache { ... | with arg-amt id body ; result } +func panic-handler { | "to be overridden"; } + def do-not-dump 0 =do-not-dump func handle-panic { | with msg trace ; program-name dup if { @@ -569,6 +571,7 @@ func handle-panic { | with msg trace ; &println trace:foreach "\nPanic message:" println " " print msg println + panic-handler def map env =map "SPL_PANIC_DUMP" env:get dup if { "Dumping because SPL_PANIC_DUMP is set." println