mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 18:27:51 +00:00
Log broad exception in Electricity Maps config flow (#140219)
This commit is contained in:
parent
7d93ceb0f0
commit
52fcdda429
@ -3,11 +3,11 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aioelectricitymaps import (
|
from aioelectricitymaps import (
|
||||||
ElectricityMaps,
|
ElectricityMaps,
|
||||||
ElectricityMapsError,
|
|
||||||
ElectricityMapsInvalidTokenError,
|
ElectricityMapsInvalidTokenError,
|
||||||
ElectricityMapsNoDataError,
|
ElectricityMapsNoDataError,
|
||||||
)
|
)
|
||||||
@ -36,6 +36,8 @@ TYPE_USE_HOME = "use_home_location"
|
|||||||
TYPE_SPECIFY_COORDINATES = "specify_coordinates"
|
TYPE_SPECIFY_COORDINATES = "specify_coordinates"
|
||||||
TYPE_SPECIFY_COUNTRY = "specify_country_code"
|
TYPE_SPECIFY_COUNTRY = "specify_country_code"
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ElectricityMapsConfigFlow(ConfigFlow, domain=DOMAIN):
|
class ElectricityMapsConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Co2signal."""
|
"""Handle a config flow for Co2signal."""
|
||||||
@ -158,7 +160,8 @@ class ElectricityMapsConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
errors["base"] = "invalid_auth"
|
errors["base"] = "invalid_auth"
|
||||||
except ElectricityMapsNoDataError:
|
except ElectricityMapsNoDataError:
|
||||||
errors["base"] = "no_data"
|
errors["base"] = "no_data"
|
||||||
except ElectricityMapsError:
|
except Exception:
|
||||||
|
_LOGGER.exception("Unexpected error occurred while checking API key")
|
||||||
errors["base"] = "unknown"
|
errors["base"] = "unknown"
|
||||||
else:
|
else:
|
||||||
if self.source == SOURCE_REAUTH:
|
if self.source == SOURCE_REAUTH:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user