Guard against logging failing
As I've seen this happening where there are errors writing to FD 1.
This commit is contained in:
parent
15d436032a
commit
65f92ca701
1 changed files with 19 additions and 6 deletions
|
|
@ -49,12 +49,25 @@
|
||||||
#t)
|
#t)
|
||||||
#f))
|
#f))
|
||||||
|
|
||||||
(define (handler request body controller secret-key-base startup-completed
|
(define (handler request finished?
|
||||||
|
body controller secret-key-base startup-completed
|
||||||
render-metrics)
|
render-metrics)
|
||||||
(display
|
(with-exception-handler
|
||||||
(format #f "~a ~a\n"
|
(lambda (exn)
|
||||||
(request-method request)
|
(with-exception-handler
|
||||||
(uri-path (request-uri request))))
|
(lambda _ #f)
|
||||||
|
(lambda ()
|
||||||
|
(simple-format (current-error-port)
|
||||||
|
"exception when logging: ~A\n" exn))
|
||||||
|
#:unwind? #t)
|
||||||
|
;; If we can't log, exit
|
||||||
|
(signal-condition! finished?))
|
||||||
|
(lambda ()
|
||||||
|
(display
|
||||||
|
(format #f "~a ~a\n"
|
||||||
|
(request-method request)
|
||||||
|
(uri-path (request-uri request)))))
|
||||||
|
#:unwind? #t)
|
||||||
(apply values
|
(apply values
|
||||||
(let-values (((request-components mime-types)
|
(let-values (((request-components mime-types)
|
||||||
(request->path-components-and-mime-type request)))
|
(request->path-components-and-mime-type request)))
|
||||||
|
|
@ -152,7 +165,7 @@ port. Also, the port used can be changed by passing the --port option.\n"
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(run-server/patched
|
(run-server/patched
|
||||||
(lambda (request body)
|
(lambda (request body)
|
||||||
(handler request body controller
|
(handler request finished? body controller
|
||||||
secret-key-base
|
secret-key-base
|
||||||
startup-completed
|
startup-completed
|
||||||
render-metrics))
|
render-metrics))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue