1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

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.
This commit is contained in:
Mark Stacey 2020-10-09 14:22:51 -02:30 committed by GitHub
parent 12f0c2161d
commit 4505ab5f2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}