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