mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-10 10:56:28 +00:00
Improve example raising ServiceValidationError (#1991)
This commit is contained in:
parent
6343922de2
commit
2456fcc659
@ -184,15 +184,15 @@ async def async_select_index(hass: HomeAssistant, index: int) -> None:
|
||||
"""Setup the config entry for my device."""
|
||||
try:
|
||||
check_index(index)
|
||||
except ValueError as ex:
|
||||
except ValueError as exc:
|
||||
raise ServiceValidationError(
|
||||
message,
|
||||
str(exc),
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="invalid_index",
|
||||
translation_placeholders={
|
||||
"index": index,
|
||||
},
|
||||
) from ex
|
||||
) from exc
|
||||
```
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user