From d8c3f9451d725f926667380f40475a31696308df Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 6 Oct 2014 20:13:57 -0300 Subject: [PATCH] Catch error when TransactionBuilder --- js/models/Wallet.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/models/Wallet.js b/js/models/Wallet.js index 590fa609a..bac2eac77 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -2177,7 +2177,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, comment, opts, cb) var ntxid = self.createTxSync(toAddress, amountSatStr, comment, safeUnspent, opts); if (!ntxid) { - return cb(new Error('Error creating TX')); + return cb(new Error('Error creating the Transaction')); } self.sendIndexes(); @@ -2212,12 +2212,19 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, comment, utxos opts[k] = Wallet.builderOpts[k]; } - var b = new Builder(opts) + var b; + + try { + b = new Builder(opts) .setUnspent(utxos) .setOutputs([{ address: toAddress, amountSatStr: amountSatStr, }]); + } catch (e) { + log.debug(e.message); + return; + }; var selectedUtxos = b.getSelectedUnspent(); var inputChainPaths = selectedUtxos.map(function(utxo) {