diff options
author | Dan Finlay <dan@danfinlay.com> | 2018-06-15 01:09:45 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2018-06-15 01:09:45 +0800 |
commit | 11bfdf444dca3917479cff82f807cc0d4c217191 (patch) | |
tree | 77b8ee63901cb1d3d1272956a10ecd6305f76065 /app/scripts/lib | |
parent | 368fe229c245a13ad59ed374b4b7f10d1f0e0488 (diff) | |
download | tangerine-wallet-browser-11bfdf444dca3917479cff82f807cc0d4c217191.tar tangerine-wallet-browser-11bfdf444dca3917479cff82f807cc0d4c217191.tar.gz tangerine-wallet-browser-11bfdf444dca3917479cff82f807cc0d4c217191.tar.bz2 tangerine-wallet-browser-11bfdf444dca3917479cff82f807cc0d4c217191.tar.lz tangerine-wallet-browser-11bfdf444dca3917479cff82f807cc0d4c217191.tar.xz tangerine-wallet-browser-11bfdf444dca3917479cff82f807cc0d4c217191.tar.zst tangerine-wallet-browser-11bfdf444dca3917479cff82f807cc0d4c217191.zip |
Handle brave throws
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/get-first-preferred-lang-code.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/scripts/lib/get-first-preferred-lang-code.js b/app/scripts/lib/get-first-preferred-lang-code.js index 2384e655e..41a886d74 100644 --- a/app/scripts/lib/get-first-preferred-lang-code.js +++ b/app/scripts/lib/get-first-preferred-lang-code.js @@ -17,12 +17,19 @@ const existingLocaleCodes = allLocales.map(locale => locale.code.toLowerCase().r * */ async function getFirstPreferredLangCode () { - let userPreferredLocaleCodes = await getPreferredLocales() - + let userPreferredLocaleCodes + + try { + userPreferredLocaleCodes = await getPreferredLocales() + } catch (e) { + // Brave currently throws when calling getAcceptLanguages, so this handles that. + userPreferredLocaleCodes = [] + } + // safeguard for Brave Browser until they implement chrome.i18n.getAcceptLanguages // https://github.com/MetaMask/metamask-extension/issues/4270 if (!userPreferredLocaleCodes){ - userPreferredLocaleCodes = [] + userPreferredLocaleCodes = [] } const firstPreferredLangCode = userPreferredLocaleCodes @@ -32,3 +39,4 @@ async function getFirstPreferredLangCode () { } module.exports = getFirstPreferredLangCode + |