[Bese-devel] UCW guidance

Pascal Bourguignon pjb at informatimago.com
Mon Sep 5 20:49:16 UTC 2005


Jan Rychter writes:
> >>>>> "Marco" == Marco Baringer <mb at bese.it>:
>  Marco> Jan Rychter <jan at rychter.com> writes:
> [...]
>  Marco> i hope this helps. the more info (doubts, questions, other
>  Marco> possiblities) the better i can help and the more ideas we can
>  Marco> bounce around.
> 
> It definitely helps! I am actually amazed by how much one can learn from
> discussions on this list. The signal to noise ratio is definitely
> high. More comments coming from me once I actually finish a reasonably
> sized application.
> 
> I've encountered the next snag: how do I error-check a form and feed it
> back to the user if it contains errors?
> 
> An example to that effect would be very, very helpful -- I couldn't find
> one in the examples.

It depends on what you mean by "feed it back to the user".

I often use this macro:

(defmacro handling-errors (&body body)
  `(HANDLER-CASE (progn , at body)
     (simple-condition 
      (ERR) 
      (format *error-output* "~&~A: ~%" (class-name (class-of err)))
      (apply (function format) *error-output*
             (simple-condition-format-control   err)
             (simple-condition-format-arguments err))
      (format *error-output* "~&"))
     (condition 
      (ERR) 
      (format *error-output* "~&~A: ~%  ~S~%" (class-name (class-of err)) err))))


(handling-errors (some-form))

Of course, you'd have to modify it to report the error via UCW.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay



More information about the bese-devel mailing list