Handle brave throws

feature/default_network_editable
Dan Finlay 7 years ago
parent 368fe229c2
commit 11bfdf444d
  1. 10
      app/scripts/lib/get-first-preferred-lang-code.js

@ -17,7 +17,14 @@ 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
@ -32,3 +39,4 @@ async function getFirstPreferredLangCode () {
}
module.exports = getFirstPreferredLangCode

Loading…
Cancel
Save