Catch error message in SBCL

Discussion of Common Lisp

Catch error message in SBCL

Postby julienvincenot » Wed Jun 12, 2019 12:28 pm


I wonder if there is a way in SBCL and CL in general, whenever any kind of error happens (undefined variable, division by zero, type error, etc.),
to prevent the debugger from popping up and then catch the error message string to display it / write it somewhere else.

Basically, I'm controlling SBCL via shell commands from inside another environment (MaxMSP).
My system in Max aims at teaching Lisp to musicians with dynamic visual interfaces,
so I want my users to be able to understand what's going on without going to the terminal themselves.

The shell object in Max can send shell commands and get its results successfully (anything that went through a PRINT function in SBCL)
but the debugger doesn't seem to take place in the same space.

Let's say I send the following command :
sbcl --core some/path/to/a/.core/file --script my/script/generated/in/maxmsp

If there's an error inside my script, in the terminal the debugger would show up then quit immediately — but Max would just show nothing until the next valid script.

What I would like to do is intercept the error message, such as
"The value 'TOTO is not of type NUMBER when binding SB-KERNEL::X",
without having to create all kinds of exceptions.

Any suggestions will be highly welcome, thanks in advance !

Posts: 1
Joined: Wed Jun 12, 2019 12:16 pm

Re: Catch error message in SBCL

Postby pjstirling » Sat Jun 15, 2019 4:46 pm

*DEBUGGER-HOOK* seems to be what you want? ... ger-hookST
Posts: 166
Joined: Sun Nov 28, 2010 4:21 pm

Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 4 guests