[racket] Handling errors from in-directory - and handling errors more generally

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Oct 14 07:41:36 EDT 2010

At Wed, 13 Oct 2010 20:48:05 -0400, Eli Barzilay wrote:
> Yesterday, Matthew Flatt wrote:
> > 
> > Code that raises an exception can include a continuation in the
> > exception to allow a restart, and the exception raised for an
> > asynchronous break (which is usually triggered when you hit Ctl-C)
> > does that. [...]
> 
> Is it supposed to be a full continuation? 

No.

> I'm getting an escape one:
> 
>   -> (let ([cont? #t])
>        (with-handlers ([exn:break?
>                         (lambda (e)
>                           (when cont?
>                             (printf "BREAK! --> jump back to ~s\n"
>                                     (exn:break-continuation e))
>                             (set! cont? #f)
>                             ((exn:break-continuation e))))])
>          (for ([i (in-naturals)]) (displayln i) (sleep 0.5))))
>   0
>   1
>   BREAK! --> jump back to #<escape-continuation>
>   continuation application: attempt to jump into an escape continuation

To successfully resume, you have have to use the lower-level
`call-with-exception-handler' layer instead of `with-handlers'.



Posted on the users mailing list.