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:
@@ -377,10 +377,10 @@ void json_add_tok(struct json_stream *result, const char *fieldname,
|
||||
memcpy(space, json_tok_full(buffer, tok), json_tok_full_len(tok));
|
||||
}
|
||||
|
||||
void json_add_errcode(struct json_stream *result, const char *fieldname,
|
||||
errcode_t code)
|
||||
void json_add_jsonrpc_errcode(struct json_stream *result, const char *fieldname,
|
||||
enum jsonrpc_errcode code)
|
||||
{
|
||||
json_add_primitive_fmt(result, fieldname, "%" PRIerrcode, code);
|
||||
json_add_primitive_fmt(result, fieldname, "%i", code);
|
||||
}
|
||||
|
||||
void json_add_invstring(struct json_stream *result, const char *invstring)
|
||||
|
||||
Reference in New Issue
Block a user