From 8abb4e5f52dc6c9dfb7a5e2f27b0cd40c21dd770 Mon Sep 17 00:00:00 2001 From: Erik Montnemery <erik@montnemery.com> Date: Sun, 28 Jan 2024 19:27:14 +0100 Subject: [PATCH] Improve display of errors with no message in script trace (#108735) --- homeassistant/helpers/trace.py | 2 +- tests/helpers/test_script.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/trace.py b/homeassistant/helpers/trace.py index 53e66e1c651..21154914f17 100644 --- a/homeassistant/helpers/trace.py +++ b/homeassistant/helpers/trace.py @@ -93,7 +93,7 @@ class TraceElement: if self._variables: result["changed_variables"] = self._variables if self._error is not None: - result["error"] = str(self._error) + result["error"] = str(self._error) or self._error.__class__.__name__ if self._result is not None: result["result"] = self._result return result diff --git a/tests/helpers/test_script.py b/tests/helpers/test_script.py index 57c1b2dd473..b0136fdebc9 100644 --- a/tests/helpers/test_script.py +++ b/tests/helpers/test_script.py @@ -1341,7 +1341,7 @@ async def test_wait_continue_on_timeout( } if continue_on_timeout is False: expected_trace["0"][0]["result"]["timeout"] = True - expected_trace["0"][0]["error"] = "" + expected_trace["0"][0]["error"] = "TimeoutError" expected_script_execution = "aborted" else: expected_trace["1"] = [{"result": {"event": "test_event", "event_data": {}}}] -- GitLab