Throw error upon currency update failure (#8944)

The currency rate controller is updated upon each network change, as
the "native currency" is network-dependent and might have changed.
However, any thrown errors were being caught and passed to an empty
callback.

The errors are now re-thrown in the callback. As a result, the errors
will now be printed to the console and sent to Sentry.
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
parent 8ff1d05df3
commit f1bfb84b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/scripts/metamask-controller.js

@ -267,7 +267,14 @@ export default class MetamaskController extends EventEmitter {
}) })
this.networkController.on('networkDidChange', () => { this.networkController.on('networkDidChange', () => {
this.setCurrentCurrency(this.currencyRateController.state.currentCurrency, function () {}) this.setCurrentCurrency(
this.currencyRateController.state.currentCurrency,
(error) => {
if (error) {
throw error
}
}
)
}) })
this.networkController.lookupNetwork() this.networkController.lookupNetwork()

Loading…
Cancel
Save