Quoth Andrei Stebakov lispercat@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