aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-04-04 01:33:10 +0800
committerkumavis <aaron@kumavis.me>2018-04-04 01:33:10 +0800
commitecbab14cae659cdcec9e59dc0a3f450069a6a05f (patch)
treef3df4bb5f9cccb9b504cba52eea8cb71f5af075f /ui
parent3e4b11e0d701441720bec665167984240a2aca56 (diff)
downloadtangerine-wallet-browser-ecbab14cae659cdcec9e59dc0a3f450069a6a05f.tar
tangerine-wallet-browser-ecbab14cae659cdcec9e59dc0a3f450069a6a05f.tar.gz
tangerine-wallet-browser-ecbab14cae659cdcec9e59dc0a3f450069a6a05f.tar.bz2
tangerine-wallet-browser-ecbab14cae659cdcec9e59dc0a3f450069a6a05f.tar.lz
tangerine-wallet-browser-ecbab14cae659cdcec9e59dc0a3f450069a6a05f.tar.xz
tangerine-wallet-browser-ecbab14cae659cdcec9e59dc0a3f450069a6a05f.tar.zst
tangerine-wallet-browser-ecbab14cae659cdcec9e59dc0a3f450069a6a05f.zip
app - warn on fetch errors instead of spamming sentry
Diffstat (limited to 'ui')
-rw-r--r--ui/i18n-helper.js21
1 files changed, 9 insertions, 12 deletions
diff --git a/ui/i18n-helper.js b/ui/i18n-helper.js
index db2fd2dc4..3eee55ae9 100644
--- a/ui/i18n-helper.js
+++ b/ui/i18n-helper.js
@@ -25,18 +25,15 @@ const getMessage = (locale, key, substitutions) => {
return phrase
}
-function fetchLocale (localeName) {
- return new Promise((resolve, reject) => {
- return fetch(`./_locales/${localeName}/messages.json`)
- .then(response => response.json())
- .then(
- locale => resolve(locale),
- error => {
- log.error(`failed to fetch ${localeName} locale because of ${error}`)
- resolve({})
- }
- )
- })
+async function fetchLocale (localeName) {
+ try {
+ const response = await fetch(`./_locales/${localeName}/messages.json`)
+ const locale = await response.json()
+ return locale
+ } catch (error) {
+ log.error(`failed to fetch ${localeName} locale because of ${error}`)
+ return {}
+ }
}
module.exports = {