[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: -introduce new convenience macro
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: -introduce new convenience macro |
Date: |
Fri, 31 Dec 2021 11:23:51 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new b49fac3d -introduce new convenience macro
b49fac3d is described below
commit b49fac3d5892f75a2eb7fbfbca0056965c6967c7
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Dec 31 11:23:42 2021 +0100
-introduce new convenience macro
---
src/include/taler_mhd_lib.h | 11 +++++++++++
src/mhd/mhd_responses.c | 6 ++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h
index 7f38ffcf..b0012a64 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.
*
diff --git a/src/mhd/mhd_responses.c b/src/mhd/mhd_responses.c
index 2918440a..a639f405 100644
--- a/src/mhd/mhd_responses.c
+++ b/src/mhd/mhd_responses.c
@@ -371,8 +371,7 @@ TALER_MHD_make_error (enum TALER_ErrorCode ec,
const char *detail)
{
return TALER_MHD_MAKE_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("code", ec),
- GNUNET_JSON_pack_string ("hint", TALER_ErrorCode_get_hint (ec)),
+ TALER_MHD_PACK_EC (ec),
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_string ("detail", detail)));
}
@@ -387,8 +386,7 @@ TALER_MHD_reply_with_error (struct MHD_Connection
*connection,
return TALER_MHD_REPLY_JSON_PACK (
connection,
http_status,
- GNUNET_JSON_pack_uint64 ("code", ec),
- GNUNET_JSON_pack_string ("hint", TALER_ErrorCode_get_hint (ec)),
+ TALER_MHD_PACK_EC (ec),
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_string ("detail", detail)));
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: -introduce new convenience macro,
gnunet <=