From 26a548a7a31078b9c8ddda10f42b659a34baa5b8 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 14 Nov 2016 11:17:53 -0800 Subject: First attempt at fixing errors in confirmation screen. --- app/scripts/lib/idStore.js | 6 +++--- app/scripts/metamask-controller.js | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index cd717df28..65b8c7029 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -248,7 +248,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone function analyzeForDelegateCall(cb){ if (txParams.to) { query.getCode(txParams.to, (err, result) => { - if (err) return cb(err) + if (err) return cb(err.message || err) var containsDelegateCall = self.checkForDelegateCall(result) txData.containsDelegateCall = containsDelegateCall cb() @@ -264,7 +264,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone var gasLimit = '0x3b9aca00' estimationParams.gas = gasLimit query.estimateGas(estimationParams, function(err, result){ - if (err) return cb(err) + if (err) return cb(err.message || err) if (result === estimationParams.gas) { txData.simulationFails = true query.getBlockByNumber('latest', true, function(err, block){ @@ -282,7 +282,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone } function didComplete (err) { - if (err) return cb(err) + if (err) return cb(err.message || err) configManager.addTx(txData) // signal update self._didUpdate() diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index da05e5f5d..5e76c5ebd 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -212,7 +212,6 @@ module.exports = class MetamaskController { newUnsignedTransaction (txParams, onTxDoneCb) { const idStore = this.idStore - let err = this.enforceTxValidations(txParams) if (err) return onTxDoneCb(err) idStore.addUnconfirmedTransaction(txParams, onTxDoneCb, (err, txData) => { -- cgit From d891869eff39cc0d617e04d0bccc88875676bac9 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 14 Nov 2016 11:17:53 -0800 Subject: First attempt at fixing errors in confirmation screen. --- app/scripts/lib/idStore.js | 6 +++--- app/scripts/metamask-controller.js | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index cd717df28..65b8c7029 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -248,7 +248,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone function analyzeForDelegateCall(cb){ if (txParams.to) { query.getCode(txParams.to, (err, result) => { - if (err) return cb(err) + if (err) return cb(err.message || err) var containsDelegateCall = self.checkForDelegateCall(result) txData.containsDelegateCall = containsDelegateCall cb() @@ -264,7 +264,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone var gasLimit = '0x3b9aca00' estimationParams.gas = gasLimit query.estimateGas(estimationParams, function(err, result){ - if (err) return cb(err) + if (err) return cb(err.message || err) if (result === estimationParams.gas) { txData.simulationFails = true query.getBlockByNumber('latest', true, function(err, block){ @@ -282,7 +282,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone } function didComplete (err) { - if (err) return cb(err) + if (err) return cb(err.message || err) configManager.addTx(txData) // signal update self._didUpdate() diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index da05e5f5d..5e76c5ebd 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -212,7 +212,6 @@ module.exports = class MetamaskController { newUnsignedTransaction (txParams, onTxDoneCb) { const idStore = this.idStore - let err = this.enforceTxValidations(txParams) if (err) return onTxDoneCb(err) idStore.addUnconfirmedTransaction(txParams, onTxDoneCb, (err, txData) => { -- cgit From 205205f7cde44841a5578726ef4231485c6974a1 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 14 Nov 2016 11:19:58 -0800 Subject: Add to changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7da7df7b..970ebde80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Current Master - Show a warning when a transaction fails during simulation. - Fix bug where 20% of gas estimate was not being added properly. +- Render error messages in our confirmation screen more gracefully. ## 2.13.7 2016-11-8 -- cgit