| 631 | } |
| 632 | |
| 633 | static void json_command_malformed(struct json_connection *jcon, |
| 634 | const char *id, |
| 635 | const char *error) |
| 636 | { |
| 637 | /* NULL writer is OK here, since we close it immediately. */ |
| 638 | struct json_stream *js = jcon_new_json_stream(jcon, jcon, NULL); |
| 639 | |
| 640 | json_object_start(js, NULL); |
| 641 | json_add_string(js, "jsonrpc", "2.0"); |
| 642 | json_add_primitive(js, "id", id); |
| 643 | json_object_start(js, "error"); |
| 644 | json_add_jsonrpc_errcode(js, "code", JSONRPC2_INVALID_REQUEST); |
| 645 | json_add_string(js, "message", error); |
| 646 | json_object_end(js); |
| 647 | json_object_end(js); |
| 648 | |
| 649 | json_stream_close(js, NULL); |
| 650 | } |
| 651 | |
| 652 | void json_notify_fmt(struct command *cmd, |
| 653 | enum log_level level, |
no test coverage detected