From 900f552ee1b36eb240da5ef07d16e02c9e41bc83 Mon Sep 17 00:00:00 2001 From: interp Date: Wed, 9 Oct 2002 15:11:55 +0000 Subject: [PATCH] Wrap error-handler around calls to LAUNCH-NEW-INSTANCE and RESUME-URL. This will catch most errors, but will fail on some, e.g. procedure called with wrong number of arguments. As far as I see, the problem is the underlying error reporting system of Scsh/Scheme48. Maybe I'm wrong. --- scheme/httpd/surflets/surflet-handler.scm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scheme/httpd/surflets/surflet-handler.scm b/scheme/httpd/surflets/surflet-handler.scm index c38f5a8..7019fe5 100644 --- a/scheme/httpd/surflets/surflet-handler.scm +++ b/scheme/httpd/surflets/surflet-handler.scm @@ -78,9 +78,19 @@ (if (or (string=? request-method "GET") (string=? request-method "POST")) (let ((response - (if (resume-url? path-string) - (resume-url path-string servlet-path req) - (launch-new-instance path-string servlet-path req)))) + (call-with-current-continuation + (lambda (exit) + (with-handler + (lambda (condition more) + (exit + (make-http-error-response + http-status/bad-gateway req + (format #f "Internal error while executing servlet ~s." path) + condition))) + (lambda () + (if (resume-url? path-string) + (resume-url path-string servlet-path req) + (launch-new-instance path-string servlet-path req)))))))) (if (redirect-body? (response-body response)) ;; Pefix it with servlet-prefix. (make-redirect-response