# HG changeset patch # User Goffi # Date 1563117953 -7200 # Node ID d2e2bf14f2e21e5609811709a5c0a9c97af8afd2 # Parent 92d0a2b785fdee3f4a70914703b14734a0846ef1 server (websocket): don't crash if self.page doesn't exist while onClose is called diff -r 92d0a2b785fd -r d2e2bf14f2e2 libervia/server/websockets.py --- a/libervia/server/websockets.py Sun Jul 14 17:18:48 2019 +0200 +++ b/libervia/server/websockets.py Sun Jul 14 17:25:53 2019 +0200 @@ -151,7 +151,14 @@ cb(page, self.request, data_json) def onClose(self, wasClean, code, reason): - self.page.onSocketClose(self.request) + try: + page = self.page + except AttributeError: + log.debug( + u"page is not available, the socket was probably not opened cleanly.\n" + u"reason: {reason}".format(reason=reason)) + return + page.onSocketClose(self.request) log.debug( _(