be more precise on error message

This commit is contained in:
Ivan Socolsky 2015-03-14 09:51:45 -03:00
parent 27920e176b
commit 21ac7b0243
2 changed files with 2 additions and 2 deletions

View File

@ -479,7 +479,7 @@ WalletService.prototype._selectTxInputs = function(txp, cb) {
var txMinAmount = txp.amount + Bitcore.Transaction.FEE_PER_KB; var txMinAmount = txp.amount + Bitcore.Transaction.FEE_PER_KB;
if (balance.totalAmount < txMinAmount) 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) if ((balance.totalAmount - balance.lockedAmount) < txMinAmount)
return cb(new ClientError('LOCKEDFUNDS', 'Funds are locked by pending transaction proposals')); return cb(new ClientError('LOCKEDFUNDS', 'Funds are locked by pending transaction proposals'));

View File

@ -938,7 +938,7 @@ describe('Copay server', function() {
server.createTx(txOpts, function(err, tx) { server.createTx(txOpts, function(err, tx) {
should.exist(err); should.exist(err);
err.code.should.equal('INSUFFICIENTFUNDS'); err.code.should.equal('INSUFFICIENTFUNDS');
err.message.should.equal('Insufficient funds'); err.message.should.equal('Insufficient funds for fee');
done(); done();
}); });
}); });