mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Return 0 for token rate fetch failures
This commit is contained in:
parent
21349dd612
commit
8c5994abc9
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user