Browse Source

jsonrpc_errors.h: Header for JSON-RPC errors.

ppa-0.6.1
ZmnSCPxj 7 years ago
committed by Christian Decker
parent
commit
6d789282c9
  1. 3
      lightningd/Makefile
  2. 5
      lightningd/jsonrpc.c
  3. 13
      lightningd/jsonrpc_errors.h

3
lightningd/Makefile

@ -78,7 +78,8 @@ ALL_OBJS += $(LIGHTNINGD_OBJS)
# We accumulate all lightningd/ headers in these three:
LIGHTNINGD_HEADERS_NOGEN = \
$(LIGHTNINGD_SRC:.c=.h) \
lightningd/peer_state.h
lightningd/peer_state.h \
lightningd/jsonrpc_errors.h
# Generated headers
LIGHTNINGD_HEADERS_GEN = \

5
lightningd/jsonrpc.c

@ -14,6 +14,7 @@
#include <fcntl.h>
#include <lightningd/chaintopology.h>
#include <lightningd/jsonrpc.h>
#include <lightningd/jsonrpc_errors.h>
#include <lightningd/lightningd.h>
#include <lightningd/log.h>
#include <lightningd/options.h>
@ -470,10 +471,6 @@ void json_add_address(struct json_result *response, const char *fieldname,
json_object_end(response);
}
#define JSONRPC2_INVALID_REQUEST -32600
#define JSONRPC2_METHOD_NOT_FOUND -32601
#define JSONRPC2_INVALID_PARAMS -32602
void command_success(struct command *cmd, struct json_result *result)
{
struct json_connection *jcon = cmd->jcon;

13
lightningd/jsonrpc_errors.h

@ -0,0 +1,13 @@
/* lightningd/jsonrpc_errors.h
* Lists error codes for JSON-RPC.
*/
#ifndef LIGHTNING_LIGHTNINGD_JSONRPC_ERRORS_H
#define LIGHTNING_LIGHTNINGD_JSONRPC_ERRORS_H
#include "config.h"
/* Standad errors defined by JSON-RPC 2.0 standard */
#define JSONRPC2_INVALID_REQUEST -32600
#define JSONRPC2_METHOD_NOT_FOUND -32601
#define JSONRPC2_INVALID_PARAMS -32602
#endif /* !defined (LIGHTNING_LIGHTNINGD_JSONRPC_ERRORS_H) */
Loading…
Cancel
Save