From c552394e55816541a9426974c5f8e6f1f83bf195 Mon Sep 17 00:00:00 2001 From: Niten Date: Wed, 18 Nov 2020 11:12:19 -0800 Subject: [PATCH] Catch all errors to keep the server up --- backplane-server.lisp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/backplane-server.lisp b/backplane-server.lisp index 39a9cb7..39ad981 100644 --- a/backplane-server.lisp +++ b/backplane-server.lisp @@ -103,11 +103,17 @@ (format *standard-output* "message received from ~A" sender) (xmpp:message conn (xmpp:from message) - (render-result (success-> message - (xmpp:body) - (decode-message) - (dispatch-parse-message sender) - (handle-message)))))) + (render-result + (handler-case + (success-> message + (xmpp:body) + (decode-message) + (dispatch-parse-message sender) + (handle-message)) + (error (e) + (format *error-output* "failed handling message from ~A: ~A" + sender e) + (make-error :msg "an unknown error occurred handling request"))))))) (let ((backplane nil)) (defun backplane-connect (xmpp-host xmpp-username xmpp-password)