Skip to content

Commit

Permalink
added localization to error string
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
  • Loading branch information
amsiglan committed Oct 11, 2024
1 parent dfa18e5 commit 21e7f86
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/plugins/data/common/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* under the License.
*/

import { i18n } from '@osd/i18n';
import {
PollQueryResultsHandler,
FetchStatusResponse,
Expand Down Expand Up @@ -58,7 +59,12 @@ export const handleQueryResults = async <T>(
if (queryStatus === 'FAILED') {
throw (

Check warning on line 60 in src/plugins/data/common/utils/helpers.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/common/utils/helpers.ts#L60

Added line #L60 was not covered by tests
(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 ?? '' },
})
)
);
}

Expand Down

0 comments on commit 21e7f86

Please sign in to comment.