Catch websocket expection

This commit is contained in:
JonnyWong16 2016-10-23 09:00:51 -07:00 committed by JonnyWong16
parent 8f22b118be
commit 17649bf36a

View file

@ -90,6 +90,9 @@ def run():
logger.error(u"PlexPy WebSocket :: %s." % e) logger.error(u"PlexPy WebSocket :: %s." % e)
reconnects += 1 reconnects += 1
time.sleep(plexpy.CONFIG.WEBSOCKET_CONNECTION_TIMEOUT) time.sleep(plexpy.CONFIG.WEBSOCKET_CONNECTION_TIMEOUT)
except (websocket.WebSocketException, Exception) as e:
logger.error(u"PlexPy WebSocket :: %s." % e)
break
while plexpy.WS_CONNECTED: while plexpy.WS_CONNECTED:
try: try:
@ -116,6 +119,9 @@ def run():
ws.shutdown() ws.shutdown()
plexpy.WS_CONNECTED = False plexpy.WS_CONNECTED = False
break break
except (websocket.WebSocketException, Exception) as e:
logger.error(u"PlexPy WebSocket :: %s." % e)
break
# Check if we recieved a restart notification and close websocket connection cleanly # Check if we recieved a restart notification and close websocket connection cleanly
if ws_reconnect: if ws_reconnect: