mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
rpc: check error now consistent with lightning-cli
We now return JSONRPC2_METHOD_NOT_FOUND if the command is not found, just like lightning-cli does. Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
parent
001e215064
commit
816840e9c4
2 changed files with 4 additions and 4 deletions
|
@ -970,9 +970,9 @@ static bool json_tok_command(struct command *cmd, const char *name,
|
|||
if (cmd->json_cmd)
|
||||
return (*out = tok);
|
||||
|
||||
command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"'%s' of '%.*s' is invalid",
|
||||
name, tok->end - tok->start, buffer + tok->start);
|
||||
command_fail(cmd, JSONRPC2_METHOD_NOT_FOUND,
|
||||
"Unknown command '%.*s'",
|
||||
tok->end - tok->start, buffer + tok->start);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1079,7 +1079,7 @@ def test_check_command(node_factory):
|
|||
l1.rpc.check(command_to_check='help', command='check')
|
||||
# Note: this just checks form, not whether it's valid!
|
||||
l1.rpc.check(command_to_check='help', command='badcommand')
|
||||
with pytest.raises(RpcError, match=r'is invalid'):
|
||||
with pytest.raises(RpcError, match=r'Unknown command'):
|
||||
l1.rpc.check(command_to_check='badcommand')
|
||||
with pytest.raises(RpcError, match=r'unknown parameter'):
|
||||
l1.rpc.check(command_to_check='help', badarg='x')
|
||||
|
|
Loading…
Add table
Reference in a new issue