From c391d69b61ebffdbabd6b562f6ea5872fee5fd7d Mon Sep 17 00:00:00 2001 From: Kevin Rickard Date: Thu, 8 Feb 2024 22:47:22 -0800 Subject: [PATCH] fix: normalize component not found error messages for GetConfiguration and UpdateConfiguration --- .../services/configstore/ConfigStoreIPCEventStreamAgent.java | 2 +- .../configstore/ConfigStoreIPCEventStreamAgentTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/aws/greengrass/builtin/services/configstore/ConfigStoreIPCEventStreamAgent.java b/src/main/java/com/aws/greengrass/builtin/services/configstore/ConfigStoreIPCEventStreamAgent.java index e9b70b89ac..d90b5e98df 100644 --- a/src/main/java/com/aws/greengrass/builtin/services/configstore/ConfigStoreIPCEventStreamAgent.java +++ b/src/main/java/com/aws/greengrass/builtin/services/configstore/ConfigStoreIPCEventStreamAgent.java @@ -193,7 +193,7 @@ public GetConfigurationResponse handleRequest(GetConfigurationRequest request) { Topics serviceTopics = kernel.findServiceTopic(finalServiceName); if (serviceTopics == null) { - throw new ResourceNotFoundError(KEY_NOT_FOUND_ERROR_MESSAGE); + throw new ResourceNotFoundError(String.format(COMPONENT_NOT_FOUND_ERROR_FORMAT, finalServiceName)); } Topics configTopics = serviceTopics.findInteriorChild(CONFIGURATION_CONFIG_KEY); diff --git a/src/test/java/com/aws/greengrass/builtin/services/configstore/ConfigStoreIPCEventStreamAgentTest.java b/src/test/java/com/aws/greengrass/builtin/services/configstore/ConfigStoreIPCEventStreamAgentTest.java index f37455e096..6697a187d7 100644 --- a/src/test/java/com/aws/greengrass/builtin/services/configstore/ConfigStoreIPCEventStreamAgentTest.java +++ b/src/test/java/com/aws/greengrass/builtin/services/configstore/ConfigStoreIPCEventStreamAgentTest.java @@ -222,7 +222,7 @@ void GIVEN_get_config_request_WHEN_component_requested_does_not_exist_THEN_fail( request.setKeyPath(Collections.singletonList("AnyKey")); ResourceNotFoundError error = assertThrows(ResourceNotFoundError.class, () -> agent.getGetConfigurationHandler(mockContext).handleRequest(request)); - assertEquals("Key not found", error.getMessage()); + assertEquals("Component config not found for component WrongComponent", error.getMessage()); } @Test