Commit de062d899afb8372affd2c0f8ef3e23447e7353a

Thomas de Grivel 2017-08-01T22:31:53

catch conditions in request handler

diff --git a/thot.lisp b/thot.lisp
index 08a7dc9..005386d 100644
--- a/thot.lisp
+++ b/thot.lisp
@@ -422,11 +422,15 @@ The requested url ~S was not found on this server."
   (loop
      (when *stop*
        (return))
-     (let* ((request (make-instance 'request :stream request-stream))
-            (reply (make-instance 'reply :stream reply-stream))
-            (result (funcall (request-reader request reply #'request-cont))))
-       (unless (eq :keep-alive result)
-         (return)))))
+     (handler-case
+         (let* ((request (make-instance 'request :stream request-stream))
+                (reply (make-instance 'reply :stream reply-stream))
+                (result (funcall (request-reader request reply #'request-cont))))
+           (unless (eq :keep-alive result)
+             (return)))
+       (t (condition)
+         (format t "~A" condition)
+         (continue)))))
 
 (defvar *acceptor-loop*)