[plt-scheme] Getting source positions in MzScheme error messages
On Thu, 2005-01-27 at 16:42 -0500, Jim Blandy wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>
> How can I get a source location along with my error message in an
> MzScheme script?
>
> $ cat bug.scm
> (car '())
> $ mzscheme -r bug.scm
> bash: mzscheme: command not found
> $ plt mzscheme -r bug.scm
> car: expects argument of type <pair>; given ()
> $
>
> I'm sure this is a FAQ, but the MzScheme folks seem to quite admirably
> forgo having a FAQ document in favor of having organized and current
> manuals. I'm happy to read, but I've not found anything.
Use the errortrace magic module, like this:
$ echo "(car '())" >> bug.scm
$ mzscheme -M errortrace -r bug.scm
car: expects argument of type <pair>; given ()
/home/gmarceau/bug.scm:1:0: (car (quote ()))
This will give you a stack trace of the location of the crash. It works
wonders in an emacs' compilation buffer.
M-x compile RET mzscheme -M errortrace -r bug.scm
then
C-x `
--
"The thing I remember most about America is that it's silly.
That can be quite a relief at times." -- Thom Yorke, Radiohead
- Guillaume