Show details about page-proxy http errors
This commit is contained in:
parent
e0e53cc07b
commit
3f1aeb8414
2 changed files with 11 additions and 9 deletions
|
@ -8,7 +8,8 @@
|
||||||
net/url
|
net/url
|
||||||
web-server/http
|
web-server/http
|
||||||
(only-in web-server/dispatchers/dispatch next-dispatcher)
|
(only-in web-server/dispatchers/dispatch next-dispatcher)
|
||||||
"url-utils.rkt")
|
"url-utils.rkt"
|
||||||
|
"xexpr-utils.rkt")
|
||||||
|
|
||||||
(provide
|
(provide
|
||||||
page-proxy)
|
page-proxy)
|
||||||
|
@ -17,11 +18,12 @@
|
||||||
(match (dict-ref (url-query (request-uri req)) 'dest #f)
|
(match (dict-ref (url-query (request-uri req)) 'dest #f)
|
||||||
[(? string? dest)
|
[(? string? dest)
|
||||||
(if (is-fandom-url? dest)
|
(if (is-fandom-url? dest)
|
||||||
|
(response-handler
|
||||||
(let ([dest-r (easy:get dest #:stream? #t)])
|
(let ([dest-r (easy:get dest #:stream? #t)])
|
||||||
(response/output
|
(response/output
|
||||||
#:code (easy:response-status-code dest-r)
|
#:code (easy:response-status-code dest-r)
|
||||||
#:mime-type (easy:response-headers-ref dest-r 'content-type)
|
#:mime-type (easy:response-headers-ref dest-r 'content-type)
|
||||||
(λ (out)
|
(λ (out)
|
||||||
(copy-port (easy:response-output dest-r) out))))
|
(copy-port (easy:response-output dest-r) out)))))
|
||||||
(next-dispatcher))]
|
(next-dispatcher))]
|
||||||
[#f (next-dispatcher)]))
|
[#f (next-dispatcher)]))
|
||||||
|
|
|
@ -190,8 +190,8 @@
|
||||||
#:code 500
|
#:code 500
|
||||||
#:mime-type #"text/plain"
|
#:mime-type #"text/plain"
|
||||||
(λ (out)
|
(λ (out)
|
||||||
(for ([port (list (current-output-port) out)])
|
(for ([port (list (current-error-port) out)])
|
||||||
(parameterize ([current-error-port out])
|
(parameterize ([current-error-port port])
|
||||||
(displayln "Exception raised in Racket code at response generation time:" (current-error-port))
|
(displayln "Exception raised in Racket code at response generation time:" (current-error-port))
|
||||||
((error-display-handler) (exn-message e) e))))))])
|
((error-display-handler) (exn-message e) e))))))])
|
||||||
body ...))
|
body ...))
|
||||||
|
|
Loading…
Reference in a new issue