From 21ac7b02430dc2490cd6be57df19c60a0a59e1cf Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Sat, 14 Mar 2015 09:51:45 -0300 Subject: [PATCH] be more precise on error message --- lib/server.js | 2 +- test/integration/server.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/server.js b/lib/server.js index 8987e06..056c74a 100644 --- a/lib/server.js +++ b/lib/server.js @@ -479,7 +479,7 @@ WalletService.prototype._selectTxInputs = function(txp, cb) { var txMinAmount = txp.amount + Bitcore.Transaction.FEE_PER_KB; if (balance.totalAmount < txMinAmount) - return cb(new ClientError('INSUFFICIENTFUNDS', 'Insufficient funds')); + return cb(new ClientError('INSUFFICIENTFUNDS', 'Insufficient funds' + (balance.totalAmount >= txp.amount ? ' for fee' : ''))); if ((balance.totalAmount - balance.lockedAmount) < txMinAmount) return cb(new ClientError('LOCKEDFUNDS', 'Funds are locked by pending transaction proposals')); diff --git a/test/integration/server.js b/test/integration/server.js index 79bd38d..d223b41 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -938,7 +938,7 @@ describe('Copay server', function() { server.createTx(txOpts, function(err, tx) { should.exist(err); err.code.should.equal('INSUFFICIENTFUNDS'); - err.message.should.equal('Insufficient funds'); + err.message.should.equal('Insufficient funds for fee'); done(); }); });