Hi!
On 2004-07-31 02:10:11, Stefan Scholl wrote:
Function send-output in modlisp.lisp handles the response for different return codes. E. g. there's a "The requested URL ~A was not found on this server." for the 404 (+http-not-found+).
How about letting the user change this behavior?
One could explain the error to the user. Maybe in another language.
Or think of all the funny 404 games. Remember the SGI babies?
I've implemented a very easy solution for this:
[Special variable] *http-error-handler*
This variable holds NIL or a function designator. The function gets called with an error code other than +http-ok+ or +http-not-modified+ and can return the content of an error page. Return NIL if the submitted error can't be handled. (Note that the handler function can access the request and reply data.)
Now my own error handler can see if it has something to say. Checking error code and maybe some further data from the request. Very KISS.
Patch attached.
Regards, Stefan