From d45774ccecaed85f45c2eebe641e2d2f8c8673af Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Aug 2021 15:36:38 +0200 Subject: introduce TALER_JSON_pack_ec --- src/include/taler_json_lib.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/include/taler_json_lib.h') diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h index f338d44ae..ea621cea6 100644 --- a/src/include/taler_json_lib.h +++ b/src/include/taler_json_lib.h @@ -79,6 +79,16 @@ TALER_JSON_pack_time_abs_nbo (const char *name, struct GNUNET_TIME_AbsoluteNBO at); +/** + * Put an error code into a JSON reply, including + * both the numeric value and the hint. + * + * @param ec error code to encode using canonical field names + */ +#define TALER_JSON_pack_ec(ec) \ + GNUNET_JSON_pack_string ("hint", TALER_ErrorCode_get_hint (ec)), \ + GNUNET_JSON_pack_uint64 ("code", ec) + /** * Generate packer instruction for a JSON field of type * absolute time creating a human-readable timestamp. -- cgit v1.2.3