1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 05:03:12 +02:00

JSON-RPC: Use proper error response with error codes according to

the official specification (one of JSON_RPC_ERROR_*).

Add proper rpc_error() and rpc_error_fmt()

Don't steal reference in rpc_response().
This commit is contained in:
Bram Matthys
2022-06-06 17:18:22 +02:00
parent 4cd520d327
commit 61ba3727df
6 changed files with 84 additions and 15 deletions
+7
View File
@@ -2300,6 +2300,13 @@ typedef enum WhoisConfigDetails {
#define UNRL_STRIP_LOW_ASCII 0x1 /**< Strip all ASCII < 32 (control codes) */
#define UNRL_STRIP_KEEP_LF 0x2 /**< Do not strip LF (line feed, \n) */
/* JSON RPC API Errors, according to jsonrpc.org spec */
#define JSON_RPC_ERROR_PARSE_ERROR -32700
#define JSON_RPC_ERROR_INVALID_REQUEST -32600
#define JSON_RPC_ERROR_METHOD_NOT_FOUND -32601
#define JSON_RPC_ERROR_INVALID_PARAMS -32602
#define JSON_RPC_ERROR_INTERNAL_ERROR -32603
#endif /* __struct_include__ */
#include "dynconf.h"