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
 | 
			
		||||
         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)]))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 ...))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue