diff --git a/scheme/httpd/surflets/surflet-handler.scm b/scheme/httpd/surflets/surflet-handler.scm index b19e768..3e9e557 100644 --- a/scheme/httpd/surflets/surflet-handler.scm +++ b/scheme/httpd/surflets/surflet-handler.scm @@ -118,6 +118,7 @@ (register-session! instance-id 'no-return) (with-fatal-handler + ;; Catch conditions from get-servlet-rt-structure. (lambda (condition decline) (delete-instance! instance-id) (bad-gateway-error-response req path-string condition)) @@ -127,10 +128,17 @@ (+ (time) (options-instance-lifetime)) memo)) (reset - (with-cwd servlet-path - (with-names-from-rt-structure - servlet servlet-interface - (main req)))))))) + (with-fatal-handler + ;; Catch conditions that occur while running the servlet. + (lambda (condition decline) + (delete-instance! instance-id) + ;; Restore correct continuation with shift. + (shift unused + (bad-gateway-error-response req path-string condition))) + (with-cwd servlet-path + (with-names-from-rt-structure + servlet servlet-interface + (main req))))))))) (else ; We'll serve every non-scm file. ;; We need access to SEND-FILE-RESPONSE of ;; HTTPD-FILE-DIR-HANDLERS. In the official SUnet release, we