Is there a way to make bitcoin-cli
output JSON-serialized errors? For example if I do
bitcoin-cli getblock foo
the output is
error code: -5
error message:
Block not found
I want the output to be something more like:
{
"error": {
"code": -5,
"message": "Block not found"
}
}
Behind the scenes, that's what the RPC response body looks like, and I want to tell bitcoin-cli, "Don't pretty-print the error if there is one. Just give me the JSON response."