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

Re: Error with WITH-HANDLER+UNIT?



>This code fragment catches an error and returns it:
>
>  > (with-handlers
>     ((identity identity))
>      (/ 1 0))
>#<struct:exn:application:divide-by-zero>
>
>But this doesn't catch the error UNIT throws
>
>  > (with-handlers
>     ((identity identity))
>      (unit (import) (export) some-unknown-variable))
>
>unit: used an unbound or non-primitive global in: some-unknown-variable

This is a syntax error, not a runtime error. So, the evaluator raises 
and error when compiling the expression, before the handler is 
installed.  I'm not sure what you are trying to do, perhaps if you 
give a little context, we can help you cath the errors you want to 
catch.

Robby