Catch ssl errors in rest (#91074)
* catch ssl.SSLError * add test * fail setup on ssl error * adjust tests
This commit is contained in:
parent
2c9e9d0fde
commit
0916701a0b
6 changed files with 117 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import ssl
|
||||
from xml.parsers.expat import ExpatError
|
||||
|
||||
from jsonpath import jsonpath
|
||||
|
@ -67,6 +68,13 @@ async def async_setup_platform(
|
|||
|
||||
if rest.data is None:
|
||||
if rest.last_exception:
|
||||
if isinstance(rest.last_exception, ssl.SSLError):
|
||||
_LOGGER.error(
|
||||
"Error connecting %s failed with %s",
|
||||
conf[CONF_RESOURCE],
|
||||
rest.last_exception,
|
||||
)
|
||||
return
|
||||
raise PlatformNotReady from rest.last_exception
|
||||
raise PlatformNotReady
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue