Plex: Add exception handler when connection fails (#8179)
* add exception handler when connection fails * plex: improve exception handling * remove uneeded exception handlerpull/8465/head
parent
71ee290bfd
commit
2eeeb9075a
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue