From 4505ab5f2b086a25164a1becdf777c7153c03782 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Fri, 9 Oct 2020 14:22:51 -0230 Subject: [PATCH] Update error message for missing substitutions (#9541) This updated error message shows the key of the message instead of the message text itself, followed by the locale code. This will make it easier to filter messages we want to ignore in Sentry. Currently it's difficult to filter because the message is radically different for each locale. With this change, we can add a filter and use a glob for the last part to filter it for all locales. It's still important to include the locale code in the message, so that we can catch cases where the message has the wrong number of substitutions for a specific locale. --- ui/app/helpers/utils/i18n-helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/helpers/utils/i18n-helper.js b/ui/app/helpers/utils/i18n-helper.js index 198e025d5..fab317705 100644 --- a/ui/app/helpers/utils/i18n-helper.js +++ b/ui/app/helpers/utils/i18n-helper.js @@ -64,7 +64,7 @@ export const getMessage = (localeCode, localeMessages, key, substitutions) => { missingSubstitutionErrors[localeCode] = {} } missingSubstitutionErrors[localeCode][key] = true - const error = new Error(`Insufficient number of substitutions for message: '${phrase}'`) + const error = new Error(`Insufficient number of substitutions for key "${key}" with locale "${localeCode}"`) log.error(error) Sentry.captureException(error) }