Show details about page-proxy http errors

This commit is contained in:
Cadence Ember 2022-09-01 16:04:48 +12:00
parent e0e53cc07b
commit 3f1aeb8414
Signed by untrusted user: cadence
GPG key ID: BC1C2C61CF521B17
2 changed files with 11 additions and 9 deletions

View file

@ -8,7 +8,8 @@
net/url
web-server/http
(only-in web-server/dispatchers/dispatch next-dispatcher)
"url-utils.rkt")
"url-utils.rkt"
"xexpr-utils.rkt")
(provide
page-proxy)
@ -17,11 +18,12 @@
(match (dict-ref (url-query (request-uri req)) 'dest #f)
[(? string? dest)
(if (is-fandom-url? dest)
(response-handler
(let ([dest-r (easy:get dest #:stream? #t)])
(response/output
#:code (easy:response-status-code dest-r)
#:mime-type (easy:response-headers-ref dest-r 'content-type)
(λ (out)
(copy-port (easy:response-output dest-r) out))))
(copy-port (easy:response-output dest-r) out)))))
(next-dispatcher))]
[#f (next-dispatcher)]))

View file

@ -190,8 +190,8 @@
#:code 500
#:mime-type #"text/plain"
(λ (out)
(for ([port (list (current-output-port) out)])
(parameterize ([current-error-port out])
(for ([port (list (current-error-port) out)])
(parameterize ([current-error-port port])
(displayln "Exception raised in Racket code at response generation time:" (current-error-port))
((error-display-handler) (exn-message e) e))))))])
body ...))