Handle when the wrong number of values is returned in the web server

This commit is contained in:
Christopher Baines 2025-01-23 19:46:43 +01:00
parent 42d885c553
commit 8a99f51bf9

View file

@ -206,8 +206,25 @@ on the procedure being called at any particular time."
stack
(current-error-port)
2)))))))
(lambda (response body)
(sanitize-response request response body))))
(match-lambda*
((response body)
(sanitize-response request response body))
(other
(let ((stack (make-stack #t))
(exception
(make-exception-with-irritants
(list (make-exception-with-message
(simple-format
#f
"wrong number of values returned from handler, expecting 2, got ~A"
(length other)))
handler))))
(print-exception
(current-error-port)
(stack-ref stack 2)
'%exception
(list exception))
(raise-exception exception))))))
#:unwind? #t)))))
(with-exception-handler
write-response-exception-handler