-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
common: move now-enlarged command_fail_badparam into its own source f…
…ile. It's getting a bit awkward to inline now: it's non-trivial. Signed-off-by: Rusty Russell <[email protected]>
- Loading branch information
1 parent
f33c518
commit 9fd29d3
Showing
16 changed files
with
118 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "config.h" | ||
#include <common/json_command.h> | ||
|
||
struct command_result * | ||
command_fail_badparam(struct command *cmd, | ||
const char *paramname, | ||
const char *buffer, | ||
const jsmntok_t *tok, | ||
const char *msg) | ||
{ | ||
if (command_dev_apis(cmd)) { | ||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS, | ||
"%s: %s: invalid token '%.*s'", | ||
paramname, msg, | ||
json_tok_full_len(tok), | ||
json_tok_full(buffer, tok)); | ||
} | ||
|
||
/* Someone misconfigured LNBITS with "" around the rune, and so the | ||
* user got a message about a bad rune parameter which *contained the | ||
* rune itself*!. LNBITS should probably swallow any JSONRPC2_* error | ||
* itself, but it is quite possibly not the only case where this case | ||
* where this can happen. So we are a little circumspect in this | ||
* case. */ | ||
command_log(cmd, LOG_INFORM, | ||
"Invalid parameter %s (%s): token '%.*s'", | ||
paramname, msg, | ||
json_tok_full_len(tok), | ||
json_tok_full(buffer, tok)); | ||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS, | ||
"%s: %s: invalid token (see logs for details)", | ||
paramname, msg); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters