mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Plex: Add exception handler when connection fails (#8179)
* add exception handler when connection fails * plex: improve exception handling * remove uneeded exception handler
This commit is contained in:
parent
71ee290bfd
commit
2eeeb9075a
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user