mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Log config_flow errors for waze_travel_time (#79352)
This commit is contained in:
parent
886e636565
commit
31ddf6cc31
@ -1,8 +1,12 @@
|
||||
"""Helpers for Waze Travel Time integration."""
|
||||
import logging
|
||||
|
||||
from WazeRouteCalculator import WazeRouteCalculator, WRCError
|
||||
|
||||
from homeassistant.helpers.location import find_coordinates
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def is_valid_config_entry(hass, origin, destination, region):
|
||||
"""Return whether the config entry data is valid."""
|
||||
@ -10,6 +14,7 @@ def is_valid_config_entry(hass, origin, destination, region):
|
||||
destination = find_coordinates(hass, destination)
|
||||
try:
|
||||
WazeRouteCalculator(origin, destination, region).calc_all_routes_info()
|
||||
except WRCError:
|
||||
except WRCError as error:
|
||||
_LOGGER.error("Error trying to validate entry: %s", error)
|
||||
return False
|
||||
return True
|
||||
|
@ -176,7 +176,7 @@ async def test_dupe(hass):
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("invalidate_config_entry")
|
||||
async def test_invalid_config_entry(hass):
|
||||
async def test_invalid_config_entry(hass, caplog):
|
||||
"""Test we get the form."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
@ -190,3 +190,5 @@ async def test_invalid_config_entry(hass):
|
||||
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
assert "Error trying to validate entry" in caplog.text
|
||||
|
Loading…
x
Reference in New Issue
Block a user