diff --git a/plugins/libplugin.c b/plugins/libplugin.c index 5e2a7a6ec..d026c22fd 100644 --- a/plugins/libplugin.c +++ b/plugins/libplugin.c @@ -263,6 +263,13 @@ struct command_result *command_done_err(struct command *cmd, return end_cmd(cmd); } +struct command_result *command_err_raw(struct command *cmd, + const char *json_str) +{ + return command_done_raw(cmd, "error", + json_str, strlen(json_str)); +} + struct command_result *timer_complete(void) { assert(in_timer > 0); diff --git a/plugins/libplugin.h b/plugins/libplugin.h index d28227b70..1eca2a6b6 100644 --- a/plugins/libplugin.h +++ b/plugins/libplugin.h @@ -62,6 +62,11 @@ command_done_err(struct command *cmd, const char *errmsg, const struct json_out *data); +/* Send a raw error response. Useful for forwarding a previous + * error after cleanup */ +struct command_result *command_err_raw(struct command *cmd, + const char *json_str); + /* This command is finished, here's the result object; @cmd cannot be NULL. */ struct command_result *WARN_UNUSED_RESULT command_success(struct command *cmd, const struct json_out *result);