Better contracts

svn: r12317
This commit is contained in:
Jay McCarthy 2008-11-05 22:31:55 +00:00
parent f33a5dbf26
commit 05f36015d5
3 changed files with 9 additions and 7 deletions

View File

@ -19,10 +19,10 @@
"with-errors-to-browser"
(test-case
"Basic"
(check-pred list? (with-errors-to-browser (lambda (x) x) (lambda () (error 'error "Hey!")))))
(check-pred list? (let/ec esc (with-errors-to-browser esc (lambda () (error 'error "Hey!"))))))
(test-case
"Basic (succ)"
(check-true (with-errors-to-browser (lambda (x) x) (lambda () #t)))))
(check-true (let/ec esc (with-errors-to-browser esc (lambda () #t))))))
(test-suite
"redirect-to"

View File

@ -547,7 +547,7 @@ functions of interest for the servlet developer.}
@defthing[see-other redirection-status?]{A @scheme[redirection-status?] for "see-other" redirections.}
@defproc[(with-errors-to-browser [send/finish-or-back (response? . -> . void?)]
@defproc[(with-errors-to-browser [send/finish-or-back (response? . -> . request?)]
[thunk (-> any)])
any]{
Calls @scheme[thunk] with an exception handler that generates an HTML error page

View File

@ -32,9 +32,6 @@
(pre ,(exn->string exn)))))))])
(thunk)))
; XXX contract
(provide
with-errors-to-browser)
(provide/contract
[redirect-to
(->* (string?) (redirection-status? #:headers (listof header?))
@ -42,4 +39,9 @@
[redirection-status? (any/c . -> . boolean?)]
[permanently redirection-status?]
[temporarily redirection-status?]
[see-other redirection-status?])
[see-other redirection-status?]
[with-errors-to-browser
((response? . -> . request?)
(-> any)
. -> .
any)])