Log HTTPSD handler failures when debug is enabled
ober
cf7cd17a94e675f970f35009f8b9f08f031ee23f
--- a/lib/std/net/httpsd.ss +++ b/lib/std/net/httpsd.ss @@ -37,6 +37,11 @@ (newline err) (flush-output-port err)))) + (def (httpsd-exception-string e) + (if (message-condition? e) + (condition-message e) + (format "~a" e))) + (def (debug-byte-preview bv len) (let* ([n (min len 200)] [copy (make-bytevector n)]) @@ -181,11 +186,15 @@ [req (let ([resp (try (normalize-response (handler req)) (catch (e) + (httpsd-debug "handler exception: " + (httpsd-exception-string e)) (th:respond-text 500 "Internal Server Error\n")))]) (write-response conn (apply-security-headers server resp)))] [status (write-error-response server conn status)] [else (void)])) (catch (e) + (httpsd-debug "client response exception: " + (httpsd-exception-string e)) (try (write-error-response server conn 500) (catch (write-e) (void))))) (try (rustls-close conn)