| 506 | } |
| 507 | |
| 508 | static void json_command_malformed(struct json_connection *jcon, |
| 509 | const char *id, |
| 510 | const char *error) |
| 511 | { |
| 512 | /* NULL writer is OK here, since we close it immediately. */ |
| 513 | struct json_stream *js = jcon_new_json_stream(jcon, jcon, NULL); |
| 514 | |
| 515 | json_object_start(js, NULL); |
| 516 | json_add_string(js, "jsonrpc", "2.0"); |
| 517 | json_add_primitive(js, "id", id); |
| 518 | json_object_start(js, "error"); |
| 519 | json_add_jsonrpc_errcode(js, "code", JSONRPC2_INVALID_REQUEST); |
| 520 | json_add_string(js, "message", error); |
| 521 | json_object_end(js); |
| 522 | json_object_end(js); |
| 523 | |
| 524 | json_stream_close(js, NULL); |
| 525 | } |
| 526 | |
| 527 | void json_notify_fmt(struct command *cmd, |
| 528 | enum log_level level, |
no test coverage detected