diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2018-04-28 01:11:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-28 01:11:20 +0800 |
commit | 387ec5b5538ecfa58ee9468e9b2c478b0d4285f4 (patch) | |
tree | 53448da98884442b6ea85706b9b075029513713d | |
parent | 1bad3fa25782a322859df8942abf39b08777f13d (diff) | |
parent | 8c5994abc9354158d74bf2079192c7f60818f9be (diff) | |
download | tangerine-wallet-browser-387ec5b5538ecfa58ee9468e9b2c478b0d4285f4.tar tangerine-wallet-browser-387ec5b5538ecfa58ee9468e9b2c478b0d4285f4.tar.gz tangerine-wallet-browser-387ec5b5538ecfa58ee9468e9b2c478b0d4285f4.tar.bz2 tangerine-wallet-browser-387ec5b5538ecfa58ee9468e9b2c478b0d4285f4.tar.lz tangerine-wallet-browser-387ec5b5538ecfa58ee9468e9b2c478b0d4285f4.tar.xz tangerine-wallet-browser-387ec5b5538ecfa58ee9468e9b2c478b0d4285f4.tar.zst tangerine-wallet-browser-387ec5b5538ecfa58ee9468e9b2c478b0d4285f4.zip |
Merge pull request #4097 from MetaMask/i4096-token-rates-error
Return 0 for token rate fetch failures
-rw-r--r-- | app/scripts/controllers/token-rates.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/scripts/controllers/token-rates.js b/app/scripts/controllers/token-rates.js index abeec4cc0..87d716aa6 100644 --- a/app/scripts/controllers/token-rates.js +++ b/app/scripts/controllers/token-rates.js @@ -1,4 +1,5 @@ const ObservableStore = require('obs-store') +const { warn } = require('loglevel') // By default, poll every 3 minutes const DEFAULT_INTERVAL = 180 * 1000 @@ -42,7 +43,10 @@ class TokenRatesController { const response = await fetch(`https://metamask.balanc3.net/prices?from=${address}&to=ETH&autoConversion=false&summaryOnly=true`) const json = await response.json() return json && json.length ? json[0].averagePrice : 0 - } catch (error) { } + } catch (error) { + warn(`MetaMask - TokenRatesController exchange rate fetch failed for ${address}.`, error) + return 0 + } } /** |