[plt-scheme] Module-based web servlet examples

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Tue Oct 17 10:53:08 EDT 2006

Norman Gray skrev:

> What I meant -- sorry for not being clearer -- was that the behaviour in 
> the presence of bad input wasn't helpful.  If something can't be 
> transformed to XML, then producing something like "garbled" or '(), or 
> even throwing an exception, would be better than (whatever it is that 
> results in) simply apparently hanging.  

Try adding a

    (report-errors-to-browser send/finish)

to the beginning of your servlet:

(module minimal-servlet mzscheme
    (provide interface-version timeout start)
    (require (lib "servlet.ss" "web-server"))
    (define interface-version 'v1)
    (define timeout 10)

    (define (start rq)
      (define-struct wibble (foo))
      (report-errors-to-browser send/finish)
      (let ((w (make-wibble "arg")))
        `(html
          (head (title "Minimal servlet"))
          (body (h1 "Minimal servlet")
                (p ,(format "~s" w))))))
)


Does that give better error messages?

Also: Check the shell where you started plt-web-server-text
for any output.

-- 
Jens Axel Søgaard




Posted on the users mailing list.