[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exceptions via port



Robert Bruce Findler <robby@cs.rice.edu> writes:

> I'm not sure if this would work for your problem at large, but one
> approximation would be to extract the `message' field of the exception
> and just send that over the port. Then, on the other end, call `error'
> with that string (or even construct
> 
> If you want to propogate more info, you can use struct->vector to
> transmit the exn record:
> 
> > (define e (with-handlers ([(lambda (x) #t) (lambda (x) x)]) (car 1)))
> > (struct->vector e)
> (vector
>   'struct:exn:application:type
>   "car: expects argument of type <pair>; given 1"
>   #<continuation-mark-set>
>   1
>   'pair)
> 
> Then, on the other side, you will need to go from the tag to the maker
> to reconstruct the exception; 
> 

I think I can do what I want with this but I don't understand what you
mean it this last line (i.e. How to reconstruct an exception?). Maybe,
I can explain a little more: I want the reader to be able to use exn?
on what it retreives from the port, some kind of:
        
        (exn? (vector->struct (struct->vector e))) -> #t

but there's no vector->struct.

-- 
The Dude: And, you know, he's got emotional problems, man. 
Walter Sobchak: You mean... beyond pacifism?

_Manuel Giraud_