problem with current-error-port in scribble interaction

10 views
Skip to first unread message

Jos Koot

unread,
Jun 27, 2019, 6:42:08 AM6/27/19
to Racket Users

 

Hi,

 

The attachments are assumed to reside in the same directory and

are reduced forms of more elaborated code.

In module try-rkt I have code that captures errors such as

to avoid an error-message being written on the current-error-port,

to retrieve the error-message and to return normally.

This works well as shown in module test-try-rkt.

However, in a scribble interaction as shown in module try-scrbl,

I get page try.html in which the interaction shows the error message

and does not show the value returned by the test-proc.

 

How can I make the interaction behave like in module test-try.rkt?

 

In module try.rkt the use of eval is necessary.

It is a strongly reduced version of a testing system

that accepts sexprs and checks the returned values, the standard output and

the error-message when an error is expected.

 

Best wishes, Jos

test-try.rkt
try.html
try.rkt
try.scrbl

Ryan Culpepper

unread,
Jun 27, 2019, 7:36:29 AM6/27/19
to Jos Koot, Racket Users
The `uncaught-exception-handler` parameter controls the *bottom* of the
exception handler stack, so it won't override the exception handler
installed by Scribble's `interaction` form. If you use `with-handlers`
(or `call-with-exception-handler`) instead, it should work.

The `uncaught-exception-handler` value is inherited by new threads, so
it shouldn't refer to a specific escape continuation. That continuation
(maybe the whole parent thread) may be gone by the time a child thread
raises an exception.

Ryan
> --
> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users...@googlegroups.com
> <mailto:racket-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/5d149d7c.1c69fb81.9bc88.bf49%40mx.google.com
> <https://groups.google.com/d/msgid/racket-users/5d149d7c.1c69fb81.9bc88.bf49%40mx.google.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Jos Koot

unread,
Jun 27, 2019, 8:27:15 AM6/27/19
to Ryan Culpepper, Racket Users

Perfect. (with-handlers ((exn:fail? exception-handler)) ...) works nice.

Thanks very much for your rapid response,

Jos

Reply all
Reply to author
Forward
0 new messages