mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 15:44:21 +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:
@@ -6,6 +6,7 @@
|
||||
#include <common/errcode.h>
|
||||
/* Simple helpers are here: this file contains heavier ones */
|
||||
#include <common/json_parse_simple.h>
|
||||
#include <common/jsonrpc_errors.h>
|
||||
|
||||
struct json_escape;
|
||||
struct json_stream;
|
||||
@@ -49,7 +50,8 @@ bool json_to_millionths(const char *buffer, const jsmntok_t *tok,
|
||||
bool json_to_int(const char *buffer, const jsmntok_t *tok, int *num);
|
||||
|
||||
/* Extract an error code from this (may be a string, or a number literal) */
|
||||
bool json_to_errcode(const char *buffer, const jsmntok_t *tok, errcode_t *errcode);
|
||||
bool json_to_jsonrpc_errcode(const char *buffer, const jsmntok_t *tok,
|
||||
enum jsonrpc_errcode *errcode);
|
||||
|
||||
/* Split a json token into 2 tokens given a splitting character */
|
||||
bool split_tok(const char *buffer, const jsmntok_t *tok,
|
||||
|
||||
Reference in New Issue
Block a user