No matter what I do, I can't define a stable custom exception handler. I've put up with the GUI-based one which I have always disliked because it is fiddly, unstable, and can't be copy-pasted easily, but I've had enough and just want a standard terminal output.
As a simple test I want to just capture the error code. At first I wanted to output to console but I've whittled it down to just that.
`0 @` works, but calling any external function leads to the handler being called in an infinite loop.
I've tried to get this to work on my 32-bit copy and the latest 64-bit release.
protectedexterns
variable err
: my-debugger ( errcode *context -- filter )
drop \ ignore context pointer for now
\ task0-io op-handle !
err !
\ ." Exception code: "
\ ." (terminal handler — no GUI popup)" cr
false
;
' my-debugger to-callback DEBUGGER
: test 255 0 ['] getcurrentdirectory catch err ? ;