summaryrefslogtreecommitdiff
path: root/src/include/taler_json_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-01 15:36:38 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-01 15:36:38 +0200
commitd45774ccecaed85f45c2eebe641e2d2f8c8673af (patch)
tree7c15d023eed2b7f47c0496ddc982d881cb398d6d /src/include/taler_json_lib.h
parentf1f0bf637bcfd7d10d3acdb328d016ccf2cc4ffb (diff)
downloadexchange-d45774ccecaed85f45c2eebe641e2d2f8c8673af.tar.gz
exchange-d45774ccecaed85f45c2eebe641e2d2f8c8673af.tar.bz2
exchange-d45774ccecaed85f45c2eebe641e2d2f8c8673af.zip
introduce TALER_JSON_pack_ec
Diffstat (limited to 'src/include/taler_json_lib.h')
-rw-r--r--src/include/taler_json_lib.h10
1 files changed, 10 insertions, 0 deletions
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
@@ -80,6 +80,16 @@ TALER_JSON_pack_time_abs_nbo (const char *name,
/**
+ * 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.
*