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.
This commit is contained in:
interp 2002-10-09 15:11:55 +00:00
parent 9e5d62aa77
commit 900f552ee1
1 changed files with 13 additions and 3 deletions

View File

@ -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