Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always set severity level flag on render_template error events #99804

Merged
merged 1 commit into from Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion homeassistant/components/websocket_api/commands.py
Expand Up @@ -565,7 +565,9 @@ def _template_listener(
if not report_errors:
return
connection.send_message(
messages.event_message(msg["id"], {"error": str(result)})
messages.event_message(
msg["id"], {"error": str(result), "level": "ERROR"}
)
)
return

Expand Down
5 changes: 4 additions & 1 deletion tests/components/websocket_api/test_commands.py
Expand Up @@ -1512,7 +1512,10 @@ async def test_render_template_with_delayed_error(
assert msg["id"] == 5
assert msg["type"] == "event"
event = msg["event"]
assert event == {"error": "UndefinedError: 'explode' is undefined"}
assert event == {
"error": "UndefinedError: 'explode' is undefined",
"level": "ERROR",
}

assert "Template variable error" not in caplog.text
assert "Template variable warning" not in caplog.text
Expand Down