mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Improve vol.Invalid handling (#120480)
This commit is contained in:
parent
ec2f98d075
commit
0bc597f8c7
@ -47,7 +47,7 @@ class InvalidBlueprint(BlueprintWithNameException):
|
||||
domain: str | None,
|
||||
blueprint_name: str | None,
|
||||
blueprint_data: Any,
|
||||
msg_or_exc: vol.Invalid,
|
||||
msg_or_exc: str | vol.Invalid,
|
||||
) -> None:
|
||||
"""Initialize an invalid blueprint error."""
|
||||
if isinstance(msg_or_exc, vol.Invalid):
|
||||
|
@ -70,11 +70,11 @@ class LogbookView(HomeAssistantView):
|
||||
if entity_ids_str := request.query.get("entity"):
|
||||
try:
|
||||
entity_ids = cv.entity_ids(entity_ids_str)
|
||||
except vol.Invalid:
|
||||
except vol.Invalid as ex:
|
||||
raise InvalidEntityFormatError(
|
||||
f"Invalid entity id(s) encountered: {entity_ids_str}. "
|
||||
"Format should be <domain>.<object_id>"
|
||||
) from vol.Invalid
|
||||
) from ex
|
||||
else:
|
||||
entity_ids = None
|
||||
|
||||
|
@ -157,7 +157,7 @@ class SetupEntity(Protocol):
|
||||
|
||||
@callback
|
||||
def async_handle_schema_error(
|
||||
discovery_payload: MQTTDiscoveryPayload, err: vol.MultipleInvalid
|
||||
discovery_payload: MQTTDiscoveryPayload, err: vol.Invalid
|
||||
) -> None:
|
||||
"""Help handling schema errors on MQTT discovery messages."""
|
||||
discovery_topic: str = discovery_payload.discovery_data[ATTR_DISCOVERY_TOPIC]
|
||||
|
Loading…
x
Reference in New Issue
Block a user