diff options
author | Ryan Huber <rhuber@gmail.com> | 2015-11-18 03:51:14 +0000 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2015-11-18 03:51:14 +0000 |
commit | 2731e7cbe568534dcba5c68e9005e955f85777a8 (patch) | |
tree | ae724a05c7fb03bf0a2a2802a90fc5820871399b /wee_slack.py | |
parent | 945e28d9d2017631dc612eebf852cb67f465e44f (diff) | |
download | wee-slack-2731e7cbe568534dcba5c68e9005e955f85777a8.tar.gz |
better handling of exception
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 7 |
1 files changed, 5 insertions, 2 deletions
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" |