| 450 | } |
| 451 | |
| 452 | struct json_stream *jsonrpc_stream_fail(struct command *cmd, |
| 453 | int code, |
| 454 | const char *err) |
| 455 | { |
| 456 | struct json_stream *js = jsonrpc_stream_start(cmd); |
| 457 | |
| 458 | assert(cmd->type == COMMAND_TYPE_NORMAL |
| 459 | || cmd->type == COMMAND_TYPE_CHECK); |
| 460 | json_object_start(js, "error"); |
| 461 | json_add_primitive_fmt(js, "code", "%d", code); |
| 462 | json_add_string(js, "message", err); |
| 463 | cmd->filter = tal_free(cmd->filter); |
| 464 | |
| 465 | return js; |
| 466 | } |
| 467 | |
| 468 | struct json_stream *jsonrpc_stream_fail_data(struct command *cmd, |
| 469 | int code, |
no test coverage detected