[racket] Strange behavior of web application , or may be not

From: Veer (diggerrrrr at gmail.com)
Date: Mon Jun 27 09:56:08 EDT 2011

Hello,

When I run this web application (given below) , I get strange behavior
 , don't know if
this is correct behavior or not.

Follow/click the link in sequence :
1. Create Something
2. Start again
3. View

So , when I click "view" I get exception instead of blank page.

code :
#lang web-server/insta
(define (start request)
  (do-1 request))

(define (do-1 request)
  (define (resp make-url)
    (response/xexpr
     `(html
       (body (a ((href ,(make-url view))) "View")
             (br)
             (a ((href ,(make-url create-something))) "Create something")))))

  (define (create-something request)
    (recur))

  (define (view request)
    (response/xexpr
     `(html)))

  (send/suspend/dispatch resp))


(define (recur)
  (do-something)
  (error 'oops "WHY ARE WE HERE?")
  (recur))

(define (do-something)
  (define (resp make-url)
    (response/xexpr
     `(html
       (body (a ((href ,(make-url start))) "Start again")))))
  (send/suspend/dispatch resp))


Thanks


Posted on the users mailing list.