aboutsummaryrefslogtreecommitdiff
path: root/diplomacy/server/connection_handler.py
diff options
context:
space:
mode:
Diffstat (limited to 'diplomacy/server/connection_handler.py')
-rw-r--r--diplomacy/server/connection_handler.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/diplomacy/server/connection_handler.py b/diplomacy/server/connection_handler.py
index 6c1351f..a70db7d 100644
--- a/diplomacy/server/connection_handler.py
+++ b/diplomacy/server/connection_handler.py
@@ -121,7 +121,8 @@ class ConnectionHandler(WebSocketHandler):
response = responses.Error(message='%s/%s' % (type(exc).__name__, exc.message),
request_id=json_request.get(strings.REQUEST_ID, None))
- try:
- yield self.write_message(response.json())
- except WebSocketClosedError:
- LOGGER.error('Websocket is closed.')
+ if response:
+ try:
+ yield self.write_message(response.json())
+ except WebSocketClosedError:
+ LOGGER.error('Websocket is closed.')