Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Paulus Schoutsen
1ef1564336 Do not log trace of expected error 2023-10-03 21:57:56 -04:00
2 changed files with 7 additions and 2 deletions

View file

@ -240,7 +240,9 @@ async def handle_call_service(
except vol.Invalid as err:
connection.send_error(msg["id"], const.ERR_INVALID_FORMAT, str(err))
except HomeAssistantError as err:
connection.logger.exception(err)
connection.logger.error(
"Error calling service %s.%s: %s", msg["domain"], msg["service"], err
)
connection.send_error(msg["id"], const.ERR_HOME_ASSISTANT_ERROR, str(err))
except Exception as err: # pylint: disable=broad-except
connection.logger.exception(err)

View file

@ -444,7 +444,9 @@ async def test_call_service_schema_validation_error(
async def test_call_service_error(
hass: HomeAssistant, websocket_client: MockHAClientWebSocket
hass: HomeAssistant,
websocket_client: MockHAClientWebSocket,
caplog: pytest.LogCaptureFixture,
) -> None:
"""Test call service command with error."""
@ -474,6 +476,7 @@ async def test_call_service_error(
assert msg["success"] is False
assert msg["error"]["code"] == "home_assistant_error"
assert msg["error"]["message"] == "error_message"
assert "Error calling service domain_test.ha_error: error_message" in caplog.text
await websocket_client.send_json(
{