[racket] Exception Stack Trace Troubles
If I understand correctly, by default, Racket doesn't provide forms with
stack trace information when running from the CLI by default. Does it
work from within DrRacket? If so, look into the errortrace module, or
add (require errortrace) to the top of the .rkt, or run it like this:
racket -l errortrace test.rkt
On Sun, 24 Jun 2012 22:01:02 +0900, Chad Albers <calbers at neomantic.com> wrote:
> Hi Eli,
>
> Thanks for you help. Unfortunately, it doesn't seem to work. I
> literally cut the code and pasted in a rkt file with #lang racket at
> the top. I ran it with the racket CLI, and received: '()
>
> Should I be invoking the CLI with some option? Any other ideas?
>
> --
> Chad
>
>
> On Sun, Jun 24, 2012 at 2:08 PM, Eli Barzilay <eli at barzilay.org> wrote:
> > A few minutes ago, Chad Albers wrote:
> >> Hi,
> >>
> >> Is there some sort of 'secret' to acquiring the stack trace of an
> >> exception? It is my understanding that when an exception is raised
> >> with the 'error' procedure in creates a exn:fail structure that has
> >> a message field and a continuation-marks field. Presumably the
> >> stack trace is in the continuation-marks field. To actually get the
> >> stack trace I need to call the following:
> >>
> >> (continuation-mark-set->context (exn-continuation-marks exception))
> >
> > This should work -- for example, I see a stack trace with:
> >
> > (with-handlers ([void (λ (e) (continuation-mark-set->context
> > (exn-continuation-marks e)))])
> > (+ 1 "two"))
> >
> >
> >> However, whenever I call this, it yields an empty list: () - Not a
> >> stack trace.
> >
> > That can happen from running code in threads which start from an empty
> > context. For example, doing the above in a thread:
> >
> > (thread (λ () (printf "~s\n" ...same...)))
> >
> > shows an empty trace.
> >
> > --
> > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
> > http://barzilay.org/ Maze is Life!
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users