From 2731e7cbe568534dcba5c68e9005e955f85777a8 Mon Sep 17 00:00:00 2001 From: Ryan Huber Date: Wed, 18 Nov 2015 03:51:14 +0000 Subject: better handling of exception --- wee_slack.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'wee_slack.py') diff --git a/wee_slack.py b/wee_slack.py index f53b22f..a023055 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -13,7 +13,7 @@ import HTMLParser import sys import traceback import collections -from websocket import create_connection +from websocket import create_connection,WebSocketConnectionClosedException # hack to make tests possible.. better way? try: @@ -1189,9 +1189,12 @@ def slack_websocket_cb(server, fd): message_json = json.loads(data) # this magic attaches json that helps find the right dest message_json['_server'] = server - except: + except WebSocketConnectionClosedException: servers.find(server).ws.close() return w.WEECHAT_RC_OK + except Exception: + dbg("socket issue: {}\n".format(traceback.format_exc())) + return w.WEECHAT_RC_OK # dispatch here if "reply_to" in message_json: function_name = "reply" -- cgit