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" "with-errors-to-browser"
(test-case (test-case
"Basic" "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 (test-case
"Basic (succ)" "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 (test-suite
"redirect-to" "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.} @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)]) [thunk (-> any)])
any]{ any]{
Calls @scheme[thunk] with an exception handler that generates an HTML error page Calls @scheme[thunk] with an exception handler that generates an HTML error page

View File

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