Merge pull request #6562 from sellout/broken-cli-help
Fix zcash-cli crash when printing help message
This commit is contained in:
commit
0679ee64b9
|
@ -212,12 +212,12 @@ UniValue ConvertValues(const std::string &strMethod, const std::vector<std::stri
|
||||||
auto helpMsg = CallRPC("help", ConvertValues("help", {strMethod}));
|
auto helpMsg = CallRPC("help", ConvertValues("help", {strMethod}));
|
||||||
return "\n\n"
|
return "\n\n"
|
||||||
+ (helpMsg.has_value()
|
+ (helpMsg.has_value()
|
||||||
? strprintf(
|
? "Usage: " + helpMsg.value().get_str()
|
||||||
|
: strprintf(
|
||||||
"An error occurred while attempting to retrieve the "
|
"An error occurred while attempting to retrieve the "
|
||||||
"help text for %s: %s",
|
"help text for %s: %s",
|
||||||
strMethod,
|
strMethod,
|
||||||
helpMsg.error().get_str())
|
helpMsg.error().get_str()));
|
||||||
: helpMsg->get_str());
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
})
|
})
|
||||||
|
|
|
@ -189,7 +189,7 @@ std::string FormatConversionFailure(const std::string& strMethod, const Conversi
|
||||||
err.providedParams);
|
err.providedParams);
|
||||||
},
|
},
|
||||||
[](const UnparseableParam& err) {
|
[](const UnparseableParam& err) {
|
||||||
return std::string("Error parsing JSON:") + err.unparsedParam;
|
return std::string("Error parsing JSON: ") + err.unparsedParam;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,7 +404,7 @@ BOOST_AUTO_TEST_CASE(rpc_insightexplorer)
|
||||||
CheckRPCThrows("getblockhashes 1477641360 1477641360 {\"noOrphans\":true,\"logicalTimes\":1}",
|
CheckRPCThrows("getblockhashes 1477641360 1477641360 {\"noOrphans\":true,\"logicalTimes\":1}",
|
||||||
"JSON value is not a boolean as expected");
|
"JSON value is not a boolean as expected");
|
||||||
CheckRPCThrows("getblockhashes 1477641360 1477641360 {\"noOrphans\":True,\"logicalTimes\":false}",
|
CheckRPCThrows("getblockhashes 1477641360 1477641360 {\"noOrphans\":True,\"logicalTimes\":false}",
|
||||||
"Error parsing JSON:{\"noOrphans\":True,\"logicalTimes\":false}");
|
"Error parsing JSON: {\"noOrphans\":True,\"logicalTimes\":false}");
|
||||||
|
|
||||||
// revert
|
// revert
|
||||||
fExperimentalInsightExplorer = false;
|
fExperimentalInsightExplorer = false;
|
||||||
|
|
|
@ -1570,7 +1570,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_mergetoaddress_parameters)
|
||||||
|
|
||||||
// bad from address
|
// bad from address
|
||||||
CheckRPCThrows("z_mergetoaddress ** " + taddr2,
|
CheckRPCThrows("z_mergetoaddress ** " + taddr2,
|
||||||
"Error parsing JSON:**");
|
"Error parsing JSON: **");
|
||||||
|
|
||||||
// bad from address
|
// bad from address
|
||||||
CheckRPCThrows("z_mergetoaddress [\"**\"] " + taddr2,
|
CheckRPCThrows("z_mergetoaddress [\"**\"] " + taddr2,
|
||||||
|
@ -1578,11 +1578,11 @@ BOOST_AUTO_TEST_CASE(rpc_z_mergetoaddress_parameters)
|
||||||
|
|
||||||
// bad from address
|
// bad from address
|
||||||
CheckRPCThrows("z_mergetoaddress " + taddr1 + " " + taddr2,
|
CheckRPCThrows("z_mergetoaddress " + taddr1 + " " + taddr2,
|
||||||
"Error parsing JSON:" + taddr1);
|
"Error parsing JSON: " + taddr1);
|
||||||
|
|
||||||
// bad from address
|
// bad from address
|
||||||
CheckRPCThrows("z_mergetoaddress [" + taddr1 + "] " + taddr2,
|
CheckRPCThrows("z_mergetoaddress [" + taddr1 + "] " + taddr2,
|
||||||
"Error parsing JSON:[" + taddr1 + "]");
|
"Error parsing JSON: [" + taddr1 + "]");
|
||||||
|
|
||||||
// bad to address
|
// bad to address
|
||||||
CheckRPCThrows("z_mergetoaddress [\"" + taddr1 + "\"] INVALID" + taddr2,
|
CheckRPCThrows("z_mergetoaddress [\"" + taddr1 + "\"] INVALID" + taddr2,
|
||||||
|
|
Loading…
Reference in New Issue