Plex: Add exception handler when connection fails (#8179)

* add exception handler when connection fails

* plex: improve exception handling

* remove uneeded exception handler
pull/8465/head
Abílio Costa 2017-07-13 16:01:12 +01:00 committed by Paulus Schoutsen
parent 71ee290bfd
commit 2eeeb9075a
1 changed files with 7 additions and 3 deletions

View File

@ -170,9 +170,9 @@ def setup_plexserver(
except plexapi.exceptions.BadRequest: except plexapi.exceptions.BadRequest:
_LOGGER.exception("Error listing plex devices") _LOGGER.exception("Error listing plex devices")
return return
except OSError: except requests.exceptions.RequestException as ex:
_LOGGER.error("Could not connect to plex server at http://%s", _LOGGER.error("Could not connect to plex server at http://%s (%s)",
host) host, ex)
return return
new_plex_clients = [] new_plex_clients = []
@ -219,6 +219,10 @@ def setup_plexserver(
except plexapi.exceptions.BadRequest: except plexapi.exceptions.BadRequest:
_LOGGER.exception("Error listing plex sessions") _LOGGER.exception("Error listing plex sessions")
return return
except requests.exceptions.RequestException as ex:
_LOGGER.error("Could not connect to plex server at http://%s (%s)",
host, ex)
return
plex_sessions.clear() plex_sessions.clear()
for session in sessions: for session in sessions: