mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 17:31:15 -04:00
Clarify Axle Energy API error messages (#182569)
This commit is contained in:
@@ -2,7 +2,12 @@
|
||||
|
||||
from typing import Any, override
|
||||
|
||||
from aioaxlevpp import AxleAuthenticationError, AxleClient, AxleError
|
||||
from aioaxlevpp import (
|
||||
AxleAuthenticationError,
|
||||
AxleClient,
|
||||
AxleConnectionError,
|
||||
AxleError,
|
||||
)
|
||||
import probatio
|
||||
|
||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||
@@ -37,8 +42,10 @@ class AxleConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
await client.get_event()
|
||||
except AxleAuthenticationError:
|
||||
return {"base": "invalid_auth"}
|
||||
except AxleError:
|
||||
except AxleConnectionError:
|
||||
return {"base": "cannot_connect"}
|
||||
except AxleError:
|
||||
return {"base": "cannot_retrieve"}
|
||||
return {}
|
||||
|
||||
@override
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"cannot_retrieve": "[%key:component::axle_energy::exceptions::cannot_connect::message%]",
|
||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
|
||||
},
|
||||
"step": {
|
||||
|
||||
@@ -36,7 +36,7 @@ async def test_user(hass: HomeAssistant) -> None:
|
||||
[
|
||||
(AxleAuthenticationError(), "invalid_auth"),
|
||||
(AxleConnectionError(), "cannot_connect"),
|
||||
(AxleError(), "cannot_connect"),
|
||||
(AxleError(), "cannot_retrieve"),
|
||||
],
|
||||
)
|
||||
async def test_user_errors(
|
||||
|
||||
Reference in New Issue
Block a user