From b49fac3d5892f75a2eb7fbfbca0056965c6967c7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 31 Dec 2021 11:23:42 +0100 Subject: -introduce new convenience macro --- src/include/taler_mhd_lib.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/include/taler_mhd_lib.h') diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h index 7f38ffcf5..b0012a645 100644 --- a/src/include/taler_mhd_lib.h +++ b/src/include/taler_mhd_lib.h @@ -249,6 +249,17 @@ TALER_MHD_make_json_pack (const char *fmt, TALER_MHD_make_json_steal (GNUNET_JSON_PACK (__VA_ARGS__)) +/** + * Pack Taler error code @a ec and associated hint into a + * JSON object. + * + * @param ec error code to pack + * @return packer array entries (two!) + */ +#define TALER_MHD_PACK_EC(ec) \ + GNUNET_JSON_pack_uint64 ("code", ec), \ + GNUNET_JSON_pack_string ("hint", TALER_ErrorCode_get_hint (ec)) + /** * Create a response indicating an internal error. * -- cgit v1.2.3