[hunchentoot-devel] Question about error handler.

Nicolas Lamirault lam at tuxfamily.org
Mon Feb 26 21:41:10 UTC 2007


hello,
thanks for reply ...


Edi Weitz <edi at agharta.de> writes:

> On Mon, 26 Feb 2007 20:11:27 +0100, Nicolas Lamirault <lam at tuxfamily.org> wrote:
>
>> i would like to print a customized error message. it is possible ?
>
> Sure.
>
>> i try to modify my code like this :
>>
>> (handler-case
>>     (progn ...)
>>   (db-connect-error (cond)
>>      (setf (hunchentoot:session-value 'error-msg) cond) 
>>      (hunchentoot:redirect "/test-lam/index"))
>>    ...)
>>
>> he index-handler which print the error message but it doesn't
>> works. The customize error handler catch the exception before
>
>>From your example it's impossible to see where the problem is.  What's
> in the "..." part?  Are you sure the error happens in there?  Are you
> sure it's of type DB-CONNECT-ERROR?


oh thanks !
i'm writing  a mail  which explain my  problem, with the  backtrace of
hunchentoot, and i find my problem !

another question :
the 

(handler-case
  (progn
     ...)
  (db-connect-error (cond) 
      (setf (hunchentoot:session-value 'error-msg) cond) 
      (hunchentoot:redirect "/test-lam/index")) 
    ...)  

works fine. But how the error dispatcher could print the error message
to the template ?

i could make this :

  (package-type-unknown-error (condition)
    (hunchentoot:log-message :warn "Clappa system : ~A" condition)
    (setf (hunchentoot:session-value 'error-msg)
          (clappa-system:package-type condition))
    (hunchentoot:redirect "/clappa/error"))


and creates a dispatcher "/clappa/error" -> error-dispatcher.
But how use the error dispatcher (with one arg) :

(defun handle-error (arg)
  "Modify the Hunchentoot error dispatcher."
  (declare (ignore arg))
  (make-web-page #p"error.html"
        (list :message (format nil "~A"
                       (hunchentoot:session-value 'error-msg)))))


?

Thanks for your help ...


-- 
Nicolas Lamirault



More information about the Tbnl-devel mailing list