Skip to content

Commit

Permalink
log error and continue
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 committed Feb 8, 2024
1 parent 531f2e8 commit d96b5f4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion homeassistant/helpers/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,13 @@ def _validate_placeholders(
for key, value in updated_resources.items():
if key not in cached_resources:
continue
tuples = list(string.Formatter().parse(value))
try:
tuples = list(string.Formatter().parse(value))
except ValueError:
_LOGGER.error(

Check warning on line 279 in homeassistant/helpers/translation.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/helpers/translation.py#L278-L279

Added lines #L278 - L279 were not covered by tests
("Error while parsing localized (%s) string %s"), language, key
)
continue

Check warning on line 282 in homeassistant/helpers/translation.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/helpers/translation.py#L282

Added line #L282 was not covered by tests
updated_placeholders = {tup[1] for tup in tuples if tup[1] is not None}

tuples = list(string.Formatter().parse(cached_resources[key]))
Expand Down

0 comments on commit d96b5f4

Please sign in to comment.