[hunchentoot-devel] Question about error handler.
Nicolas Lamirault
lam at tuxfamily.org
Mon Feb 26 19:11:27 UTC 2007
hi all
i make my website with hunchentoot. it works very fine.
My database backend could throw some conditions (db-connect-error,
db-...-error, ...), and i would like to print the error message.
i have modify the default error handler like this :
(defun handle-error (arg)
"Modify the Hunchentoot error dispatcher."
;;(declare (ignore arg))
(make-web-page #p"error.html"
(list :message (format nil "~A" arg))))
and the HTML template :
<div id="title"> Error </div>
<div id="error">
<b> Internal error : </b> <br>
<!-- TMPL_VAR message -->
</div>
in the final web page i see :
<div id="title"> Error </div>
Internal error :
500
i would like to print a customized error message. it is possible ?
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
someone knows how could i make this ?
thanks for any help.
--
Nicolas Lamirault
More information about the Tbnl-devel
mailing list