[hunchentoot-devel] *show-lisp-errors-p* ignored?
Sebastian Tennant
sebyte at smolny.plus.com
Tue Jul 24 18:00:35 UTC 2012
Quoth Andrei Stebakov <lispercat at gmail.com>:
> As I understand the whole acceptor-status-message has to be overloaded?
(use-package :hunchentoot)
First you have to subclass acceptor. For example:
(defclass custom-acceptor (acceptor) nil)
Now you can specialise acceptor-status-message on custom-acceptor like so:
(defmethod acceptor-status-message
((acceptor custom-acceptor) http-status-code &rest args &key &allow-other-keys)
(when (equal http-status-code +http-internal-server-error+)
(apply custom-error-page args))
(call-next-method))
Finally define custom-error-page:
(defun custom-error-page (k1 error k2 backtrace)
(format nil
"<html>
<head></head>
<body>
<h2>whoops!</h2>
<p>Error: ~a</p>
~a
</body>
</html>"
error backtrace))
Don't forget to start your custom-acceptor like so:
(tbnl:start (make-instance 'custom-acceptor ...))
Hope this helps. None of this code is tested by the way.
Seb
--
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap
More information about the Tbnl-devel
mailing list