[plt-scheme] Error Checking

From: Jakub Piotr Cłapa (jpc-ml at zenburn.net)
Date: Thu Jun 18 16:49:26 EDT 2009

On 6/18/09 7:43 PM, Paulo J. Matos wrote:
> I have tried to look at the
> definition of raise-user-error in the plt source code but couldn't
> find anything. Can someone point me to it or correct my design if I
> could do something simpler?

The raise functions are actually very simple. This is how I do it:

(define-struct (exn:fail:syntax exn:fail) ())

(define (raise-syntax-error msg)
   (raise (make-exn:fail:syntax msg (current-continuation-marks))))

You would probably like to do something more interesing with msg.

PS. Good exception design is something I am not quite sure how to do in 
Scheme (it is easier in Python). I also wonder whether restartable 
exceptions (a'la Common Lisp) are a good idea.

-- 
regards,
Jakub Piotr Cłapa


Posted on the users mailing list.