mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
jsonrpc: make error codes an enum.
This allows GDB to print values, but also allows us to use them in 'case' statements. This wasn't allowed before because they're not constant terms. This also made it clear there's a clash between two error codes, so move one. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Changed: JSON-RPC: Error code from bcli plugin changed from 400 to 500.
This commit is contained in:
@@ -389,14 +389,14 @@ command_success(struct command *cmd, const struct json_out *result)
|
||||
}
|
||||
|
||||
struct command_result *command_done_err(struct command *cmd,
|
||||
errcode_t code,
|
||||
enum jsonrpc_errcode code,
|
||||
const char *errmsg,
|
||||
const struct json_out *data)
|
||||
{
|
||||
struct json_stream *js = jsonrpc_stream_start(cmd);
|
||||
|
||||
json_object_start(js, "error");
|
||||
json_add_errcode(js, "code", code);
|
||||
json_add_jsonrpc_errcode(js, "code", code);
|
||||
json_add_string(js, "message", errmsg);
|
||||
|
||||
if (data)
|
||||
@@ -442,7 +442,7 @@ struct command_result *forward_result(struct command *cmd,
|
||||
|
||||
/* Called by param() directly if it's malformed. */
|
||||
struct command_result *command_fail(struct command *cmd,
|
||||
errcode_t code, const char *fmt, ...)
|
||||
enum jsonrpc_errcode code, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
struct command_result *res;
|
||||
|
||||
Reference in New Issue
Block a user