From 21e7f86e20b33ea57b65c0f6a1a73a78e007fe5f Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Fri, 11 Oct 2024 12:01:50 -0700 Subject: [PATCH] added localization to error string Signed-off-by: Amardeepsingh Siglani --- src/plugins/data/common/utils/helpers.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/data/common/utils/helpers.ts b/src/plugins/data/common/utils/helpers.ts index 20451757430e..2a4fefb59944 100644 --- a/src/plugins/data/common/utils/helpers.ts +++ b/src/plugins/data/common/utils/helpers.ts @@ -28,6 +28,7 @@ * under the License. */ +import { i18n } from '@osd/i18n'; import { PollQueryResultsHandler, FetchStatusResponse, @@ -58,7 +59,12 @@ export const handleQueryResults = async ( if (queryStatus === 'FAILED') { throw ( (queryResultsRes as QueryFailedStatusResponse).body.error ?? - new Error(`Failed to fetch results ${queryId ?? ''}`) + new Error( + i18n.translate('data.search.request.failed', { + defaultMessage: 'Failed to fetch results for queryId: {queryId}', + values: { queryId: queryId ?? '' }, + }) + ) ); }