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':
|
case 'EncodingError':
|
||||||
code = RPCBase.errors.DESERIALIZATION_ERROR;
|
code = RPCBase.errors.DESERIALIZATION_ERROR;
|
||||||
break;
|
break;
|
||||||
|
case 'FundingError':
|
||||||
|
code = RPCBase.errors.WALLET_INSUFFICIENT_FUNDS;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
code = RPCBase.errors.INTERNAL_ERROR;
|
code = RPCBase.errors.INTERNAL_ERROR;
|
||||||
this.logger.error('RPC internal error.');
|
this.logger.error('RPC internal error.');
|
||||||
|
|||||||
@ -171,11 +171,7 @@ RPC.prototype.fundRawTransaction = co(function* fundRawTransaction(args, help) {
|
|||||||
changeAddress: change
|
changeAddress: change
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
yield wallet.fund(tx, options);
|
||||||
yield wallet.fund(tx, options);
|
|
||||||
} catch (e) {
|
|
||||||
throw new RPCError(errs.WALLET_INSUFFICIENT_FUNDS, e.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
hex: tx.toRaw().toString('hex'),
|
hex: tx.toRaw().toString('hex'),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user