MCPcopy Create free account
hub / github.com/ElementsProject/lightning / command_fail_badparam

Function command_fail_badparam

common/json_command.c:4–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <common/json_command.h>
3
4struct command_result *
5command_fail_badparam(struct command *cmd,
6 const char *paramname,
7 const char *buffer,
8 const jsmntok_t *tok,
9 const char *msg)
10{
11 if (command_dev_apis(cmd) || command_check_only(cmd)) {
12 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
13 "%s: %s: invalid token '%.*s'",
14 paramname, msg,
15 json_tok_full_len(tok),
16 json_tok_full(buffer, tok));
17 }
18
19 /* Someone misconfigured LNBITS with "" around the rune, and so the
20 * user got a message about a bad rune parameter which *contained the
21 * rune itself*!. LNBITS should probably swallow any JSONRPC2_* error
22 * itself, but it is quite possibly not the only case where this case
23 * where this can happen. So we are a little circumspect in this
24 * case. */
25 command_log(cmd, LOG_INFORM,
26 "Invalid parameter %s (%s): token '%.*s'",
27 paramname, msg,
28 json_tok_full_len(tok),
29 json_tok_full(buffer, tok));
30 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
31 "%s: %s: invalid token (see logs for details)",
32 paramname, msg);
33}

Callers 15

param_channel_typeFunction · 0.70
param_arrayFunction · 0.70
param_boolFunction · 0.70
param_millionthsFunction · 0.70
param_escaped_stringFunction · 0.70
param_string_arrayFunction · 0.70
param_labelFunction · 0.70
param_numberFunction · 0.70
param_sha256Function · 0.70
param_u16Function · 0.70
param_u32Function · 0.70
param_u64Function · 0.70

Calls 6

command_dev_apisFunction · 0.50
command_check_onlyFunction · 0.50
command_failFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
command_logFunction · 0.50

Tested by

no test coverage detected