Fix CO2signal error handling (#61311)
parent
8f238d6b53
commit
2e65923205
|
@ -134,9 +134,6 @@ def get_data(hass: HomeAssistant, config: dict) -> CO2SignalResponse:
|
||||||
|
|
||||||
_LOGGER.exception("Unexpected exception")
|
_LOGGER.exception("Unexpected exception")
|
||||||
raise UnknownError from err
|
raise UnknownError from err
|
||||||
except Exception as err:
|
|
||||||
_LOGGER.exception("Unexpected exception")
|
|
||||||
raise UnknownError from err
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if "error" in data:
|
if "error" in data:
|
||||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CON
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
from . import APIRatelimitExceeded, CO2Error, InvalidAuth, UnknownError, get_data
|
from . import APIRatelimitExceeded, CO2Error, InvalidAuth, get_data
|
||||||
from .const import CONF_COUNTRY_CODE, DOMAIN
|
from .const import CONF_COUNTRY_CODE, DOMAIN
|
||||||
from .util import get_extra_name
|
from .util import get_extra_name
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
errors["base"] = "invalid_auth"
|
errors["base"] = "invalid_auth"
|
||||||
except APIRatelimitExceeded:
|
except APIRatelimitExceeded:
|
||||||
errors["base"] = "api_ratelimit"
|
errors["base"] = "api_ratelimit"
|
||||||
except UnknownError:
|
except Exception: # pylint: disable=broad-except
|
||||||
errors["base"] = "unknown"
|
errors["base"] = "unknown"
|
||||||
else:
|
else:
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
|
|
Loading…
Reference in New Issue