Auto merge of #1976 - bitcartel:1964_z_sendmany_exception_handling, r=ebfull
Fixes #1964 to catch general exception in z_sendmany and catch exceptions as reference-to-const.
This commit is contained in:
@@ -2963,7 +2963,7 @@ Value z_listreceivedbyaddress(const Array& params, bool fHelp)
|
||||
CZCPaymentAddress address(fromaddress);
|
||||
try {
|
||||
zaddr = address.Get();
|
||||
} catch (std::runtime_error) {
|
||||
} catch (const std::runtime_error&) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid zaddr.");
|
||||
}
|
||||
|
||||
@@ -3030,7 +3030,7 @@ Value z_getbalance(const Array& params, bool fHelp)
|
||||
CZCPaymentAddress address(fromaddress);
|
||||
try {
|
||||
zaddr = address.Get();
|
||||
} catch (std::runtime_error) {
|
||||
} catch (const std::runtime_error&) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid from address, should be a taddr or zaddr.");
|
||||
}
|
||||
if (!pwalletMain->HaveSpendingKey(zaddr)) {
|
||||
@@ -3241,7 +3241,7 @@ Value z_sendmany(const Array& params, bool fHelp)
|
||||
CZCPaymentAddress address(fromaddress);
|
||||
try {
|
||||
zaddr = address.Get();
|
||||
} catch (std::runtime_error) {
|
||||
} catch (const std::runtime_error&) {
|
||||
// invalid
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid from address, should be a taddr or zaddr.");
|
||||
}
|
||||
@@ -3288,7 +3288,7 @@ Value z_sendmany(const Array& params, bool fHelp)
|
||||
CZCPaymentAddress zaddr(address);
|
||||
zaddr.Get();
|
||||
isZaddr = true;
|
||||
} catch (std::runtime_error) {
|
||||
} catch (const std::runtime_error&) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, unknown address format: ")+address );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user