The reality of Stefan Scholl

"I hope there's pudding"

TBNL 0.3.12 released

Edi Weitz released

TBNL 0.3.12 two days ago
(announcement).
It now has a special variable *HTTP-ERROR-HANDLER* (defaults to NIL) which can
hold a function designator to an error handler for HTTP
errors like the 404 Not Found error.




In the following example a simple error handler just handles the 404 error. Every other error
returns NIL and TBNL takes over. The function could
emit some explanation about the site's structure or just show the wrong part of the URL and make fun of
the visitor. :-)

(defun http-error-handler (code)
"Return content for error output of HTTP error CODE."
(case code
(404 (emb:execute-emb *fnf-error-template*
`(:code 404 :uri ,(tbnl:request-uri))))))

(setf tbnl:*http-error-handler* 'http-error-handler)


Tags: TBNL, Lisp