Improve error message

This commit is contained in:
jbouwh 2024-04-15 19:32:32 +00:00
parent bc86c53756
commit ac352d75b0
3 changed files with 3 additions and 2 deletions

View File

@ -196,7 +196,7 @@
"message": "A service which does not return responses can't be called with {return_response}."
},
"service_lacks_response_request": {
"message": "The service call requires responses but caller did not ask for responses."
"message": "The service call requires responses and must be called with {return_response}."
},
"service_reponse_invalid": {
"message": "Failed to process the returned service response data, expected a dictionary, but got {response_data_type}."

View File

@ -2592,6 +2592,7 @@ class ServiceRegistry:
raise ServiceValidationError(
translation_domain=DOMAIN,
translation_key="service_lacks_response_request",
translation_placeholders={"return_response": "return_response=True"},
)
if target:

View File

@ -1850,7 +1850,7 @@ async def test_serviceregistry_return_response_invalid(
("supports_response", "return_response", "expected_error"),
[
(SupportsResponse.NONE, True, "does not return responses"),
(SupportsResponse.ONLY, False, "caller did not ask for responses"),
(SupportsResponse.ONLY, False, "call requires responses"),
],
)
async def test_serviceregistry_return_response_arguments(