summaryrefslogtreecommitdiff
path: root/src/include/taler_templating_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-05-06 20:55:40 +0200
committerChristian Grothoff <christian@grothoff.org>2023-05-06 20:55:40 +0200
commit404b2b78f187e3da2fedee5748b9bfcdfa4a105c (patch)
treef774b8ca0ea11d8886c7ff02f024c9588bbeef74 /src/include/taler_templating_lib.h
parent1f9427e1d9672b93577aea4c9d5a63575ee0b525 (diff)
downloadexchange-404b2b78f187e3da2fedee5748b9bfcdfa4a105c.tar.gz
exchange-404b2b78f187e3da2fedee5748b9bfcdfa4a105c.tar.bz2
exchange-404b2b78f187e3da2fedee5748b9bfcdfa4a105c.zip
add convenience function TALER_TEMPLATING_reply_error
Diffstat (limited to 'src/include/taler_templating_lib.h')
-rw-r--r--src/include/taler_templating_lib.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/taler_templating_lib.h b/src/include/taler_templating_lib.h
index 53946b9c0..ebda2ecf3 100644
--- a/src/include/taler_templating_lib.h
+++ b/src/include/taler_templating_lib.h
@@ -91,6 +91,26 @@ TALER_TEMPLATING_reply (struct MHD_Connection *connection,
const char *taler_uri,
const json_t *root);
+
+/**
+ * Load a @a template and substitute an error message based on @a ec and @a
+ * detail, returning the result to the @a connection with the given @a
+ * http_status code.
+ *
+ * @param connection the connection we act upon
+ * @param template basename of the template to load
+ * @param http_status code to use on success
+ * @param ec error code to return
+ * @param detail optional text to add to the template
+ * @return #MHD_YES on success, #MHD_NO to just close the connection
+ */
+MHD_RESULT
+TALER_TEMPLATING_reply_error (struct MHD_Connection *connection,
+ const char *template_basename,
+ unsigned int http_status,
+ enum TALER_ErrorCode ec,
+ const char *detail);
+
/**
* Preload templates.
*