add an overridable panic handler

This commit is contained in:
Daniella / Tove 2024-11-20 15:21:05 +01:00
parent dd02cc1fc4
commit f6faf029cd
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -559,6 +559,8 @@ func cache { ... | with arg-amt id body ;
result result
} }
func panic-handler { | "to be overridden"; }
def do-not-dump 0 =do-not-dump def do-not-dump 0 =do-not-dump
func handle-panic { | with msg trace ; func handle-panic { | with msg trace ;
program-name dup if { program-name dup if {
@ -569,6 +571,7 @@ func handle-panic { | with msg trace ;
&println trace:foreach &println trace:foreach
"\nPanic message:" println "\nPanic message:" println
" " print msg println " " print msg println
panic-handler
def map env =map def map env =map
"SPL_PANIC_DUMP" env:get dup if { "SPL_PANIC_DUMP" env:get dup if {
"Dumping because SPL_PANIC_DUMP is set." println "Dumping because SPL_PANIC_DUMP is set." println