Commit b454a9a0 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #782 from ethereum/invalidAddress

Try catch on sendTransaction (metamask can throw)
parents 780e93b3 691ec1cf
...@@ -64,13 +64,17 @@ TxRunner.prototype.execute = function (args, callback) { ...@@ -64,13 +64,17 @@ TxRunner.prototype.execute = function (args, callback) {
} }
tx.gas = gasEstimation tx.gas = gasEstimation
var sendTransaction = self.personalMode ? executionContext.web3().personal.sendTransaction : executionContext.web3().eth.sendTransaction var sendTransaction = self.personalMode ? executionContext.web3().personal.sendTransaction : executionContext.web3().eth.sendTransaction
sendTransaction(tx, function (err, resp) { try {
if (err) { sendTransaction(tx, function (err, resp) {
return callback(err, resp) if (err) {
} return callback(err, resp)
}
tryTillResponse(resp, callback) tryTillResponse(resp, callback)
}) })
} catch (e) {
return callback(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `)
}
}) })
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment