diff --git a/server/api/api.lisp b/server/api/api.lisp index d41921e..af5fe13 100644 --- a/server/api/api.lisp +++ b/server/api/api.lisp @@ -56,12 +56,19 @@ (defmethod handle-request ((api api) request) - (let* ((data (parse-request request)) - (type (getf data :type))) - (cond - ((equal type "new-game") (handle-new-game api data)) - ((equal type "update") (handle-update api data)) - (t (format t "Unknow type"))))) + (flet ((handle-fun () + (let* ((data (parse-request request)) + (type (getf data :type))) + (cond + ((equal type "new-game") (handle-new-game api data)) + ((equal type "update") (handle-update api data)) + (t (format t "Unknow type")))))) + + (handler-case + (handle-fun) + (t (c) + (format t "Got an exception: ~a~%" c) + "Bad request"))))