rpc: better funding errors.
This commit is contained in:
parent
1458366441
commit
66c4fd8a77
@ -195,6 +195,9 @@ RPCBase.prototype.call = co(function* call(body, query) {
|
||||
case 'EncodingError':
|
||||
code = RPCBase.errors.DESERIALIZATION_ERROR;
|
||||
break;
|
||||
case 'FundingError':
|
||||
code = RPCBase.errors.WALLET_INSUFFICIENT_FUNDS;
|
||||
break;
|
||||
default:
|
||||
code = RPCBase.errors.INTERNAL_ERROR;
|
||||
this.logger.error('RPC internal error.');
|
||||
|
||||
@ -171,11 +171,7 @@ RPC.prototype.fundRawTransaction = co(function* fundRawTransaction(args, help) {
|
||||
changeAddress: change
|
||||
};
|
||||
|
||||
try {
|
||||
yield wallet.fund(tx, options);
|
||||
} catch (e) {
|
||||
throw new RPCError(errs.WALLET_INSUFFICIENT_FUNDS, e.message);
|
||||
}
|
||||
yield wallet.fund(tx, options);
|
||||
|
||||
return {
|
||||
hex: tx.toRaw().toString('hex'),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user