chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Trapping Scheme-level errors


From: felix winkelmann
Subject: Re: [Chicken-users] Trapping Scheme-level errors
Date: Sun, 26 Mar 2006 10:09:39 +0200

On 3/26/06, John Cowan <address@hidden> wrote:
> I'm using Chicken 2.3 under Cygwin to develop an interpreter for a
> non-Scheme language with its own REPL.  I would like to trap Scheme
> errors, such as "attempt to take the car of ()", and continue the
> non-Scheme REPL instead of Scheme's.  This will be particularly
> important in the compiled version of the interpreter.
>
> What's the right way to do that?  Defining "error-handler" doesn't
> seem to do anything either in interpreted or compiled code.

Use exception handling:

(define (myrepl)
  (handle-exceptions ex
    ...do domething...
    (myeval ...) )
  (myrepl) )

or:

...
(condition-case (myeval ...)
  (ex (exn) ...scheme error...)
  (ex () ...your own exception...) )
...


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]