Skip to content

Commit 0bc597f

Browse files
authored
Improve vol.Invalid handling (#120480)
1 parent ec2f98d commit 0bc597f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

homeassistant/components/blueprint/errors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(
4747
domain: str | None,
4848
blueprint_name: str | None,
4949
blueprint_data: Any,
50-
msg_or_exc: vol.Invalid,
50+
msg_or_exc: str | vol.Invalid,
5151
) -> None:
5252
"""Initialize an invalid blueprint error."""
5353
if isinstance(msg_or_exc, vol.Invalid):

homeassistant/components/logbook/rest_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ async def get(
7070
if entity_ids_str := request.query.get("entity"):
7171
try:
7272
entity_ids = cv.entity_ids(entity_ids_str)
73-
except vol.Invalid:
73+
except vol.Invalid as ex:
7474
raise InvalidEntityFormatError(
7575
f"Invalid entity id(s) encountered: {entity_ids_str}. "
7676
"Format should be <domain>.<object_id>"
77-
) from vol.Invalid
77+
) from ex
7878
else:
7979
entity_ids = None
8080

homeassistant/components/mqtt/mixins.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ async def __call__(
157157

158158
@callback
159159
def async_handle_schema_error(
160-
discovery_payload: MQTTDiscoveryPayload, err: vol.MultipleInvalid
160+
discovery_payload: MQTTDiscoveryPayload, err: vol.Invalid
161161
) -> None:
162162
"""Help handling schema errors on MQTT discovery messages."""
163163
discovery_topic: str = discovery_payload.discovery_data[ATTR_DISCOVERY_TOPIC]

0 commit comments

Comments
 (0)