common/json: add a json helper for the new errcode type

This commit is contained in:
darosior 2020-02-01 19:34:35 +01:00 committed by Rusty Russell
parent 42cd23092c
commit e6f56765ca
2 changed files with 10 additions and 0 deletions

View File

@ -762,3 +762,9 @@ void json_add_tok(struct json_stream *result, const char *fieldname,
}
abort();
}
void json_add_errcode(struct json_stream *result, const char *fieldname,
errcode_t code)
{
json_add_member(result, fieldname, false, "%"PRIerrcode, code);
}

View File

@ -264,5 +264,9 @@ void json_add_preimage(struct json_stream *result, const char *fieldname,
void json_add_tok(struct json_stream *result, const char *fieldname,
const jsmntok_t *tok, const char *buffer);
/* Add an error code */
void json_add_errcode(struct json_stream *result, const char *fieldname,
errcode_t code);
#endif /* LIGHTNING_COMMON_JSON_H */