]> git.pond.sub.org Git - eow/blobdiff - web.lisp
Handle connection refused and closed
[eow] / web.lisp
index 0f6a0c8966fed615898f2b3baa4a289d7233f063..5c186c95f549f3cf0bf5d69409f7ff5d7d6853e6 100644 (file)
--- a/web.lisp
+++ b/web.lisp
 
 ;; destination of login-form
 (defun login-action ()
-  (let ((connection (empire:connect :user (post-parameter "username")
-                                   :password (post-parameter "password"))))
-    (setf (session-value 'connection) connection)
-    (redirect +root-url+)))
+  (handler-case
+      (let ((connection (empire:connect :user (post-parameter "username")
+                                       :password (post-parameter "password"))))
+       (setf (session-value 'connection) connection)
+       (redirect +root-url+))
+    (usocket:connection-refused-error (e)
+      (format nil "Connection error: ~a~%" e))))
 
 (defun command-action ()
   (let ((connection (session-value 'connection)))