Our program demonstrates the concept of error handling and program termination in Lisp. Here’s the full source code:
Running this program will cause it to raise an error, print an error message and backtrace, and exit with a non-zero status.
When the first error in main is raised, the program exits without reaching the rest of the code. If you’d like to see the program try to create a temp file, comment out the first error.
Note that in Lisp, we use the condition system for handling many errors. It’s idiomatic to use handler-case and error for error handling and signaling respectively.