1 Quick Instructions
First, throw away ".zo" versions of your program—
Then,
If your program has a module file ‹prog›, run it with
racket -l errortrace -t ‹prog›
- If you program is a non-module top-level sequence of definitions and expressions, you can instead add
(require errortrace)
to the beginning of the program or start Racket with the -l option before the arguments to load your program:racket -l errortrace ... - If you have no main program and you want to use Racket interactively, include the -i flag before -l:racket -i -l errortrace
- To instrument the contents of a collection or package, compile it with:raco setup --mode errortrace ...
After starting errortrace in one of these ways, when an exception occurs, the exception handler prints something like a stack trace with most recent contexts first.
The errortrace module is strange: Don’t import it into another module. Instead, the errortrace module is meant to be invoked from the top-level, so that it can install an evaluation handler, exception handler, etc.
To reuse parts of the code of errortrace, import errortrace/errortrace-lib. That library contains all of the bindings described here, but does not set the compilation handler or the error display handler.