[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 119/277: better error handling
From: |
gnunet |
Subject: |
[taler-merchant] 119/277: better error handling |
Date: |
Sun, 05 Jul 2020 20:50:32 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit 7d83b800d2aeb814032ae69007290f69aace42c3
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon May 18 19:28:45 2020 +0200
better error handling
---
src/backend/taler-merchant-httpd_exchanges.c | 2 +-
.../taler-merchant-httpd_private-post-reserves.c | 38 ++++++++++++++++++----
2 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_exchanges.c
b/src/backend/taler-merchant-httpd_exchanges.c
index 24b5202..c6e7ca7 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -656,7 +656,7 @@ handle_wire_data (void *cls,
{
fo->fc (fo->fc_cls,
hr,
- NULL,
+ exchange->conn,
NULL,
NULL,
GNUNET_NO);
diff --git a/src/backend/taler-merchant-httpd_private-post-reserves.c
b/src/backend/taler-merchant-httpd_private-post-reserves.c
index abb6d0b..0c62ce7 100644
--- a/src/backend/taler-merchant-httpd_private-post-reserves.c
+++ b/src/backend/taler-merchant-httpd_private-post-reserves.c
@@ -84,6 +84,16 @@ struct PostReserveContext
*/
struct GNUNET_TIME_Absolute reserve_expiration;
+ /**
+ * Which HTTP status should we return?
+ */
+ unsigned int http_status;
+
+ /**
+ * Which error code should we return?
+ */
+ enum TALER_ErrorCode ec;
+
/**
* Are we suspended?
*/
@@ -175,14 +185,28 @@ handle_exchange (void *cls,
rc->suspended = false;
MHD_resume_connection (rc->connection);
+ if (NULL == hr)
+ {
+ rc->ec = TALER_EC_TIMEOUT;
+ rc->http_status = MHD_HTTP_REQUEST_TIMEOUT;
+ return;
+ }
keys = TALER_EXCHANGE_get_keys (eh);
- if ( (NULL != keys) &&
- (NULL != payto_uri) )
+ if (NULL == keys)
+ {
+ rc->ec = TALER_EC_KEYS_INVALID;
+ rc->http_status = MHD_HTTP_FAILED_DEPENDENCY;
+ return;
+ }
+ if (NULL == payto_uri)
{
- rc->reserve_expiration
- = GNUNET_TIME_relative_to_absolute (keys->reserve_closing_delay);
- rc->payto_uri = GNUNET_strdup (payto_uri);
+ rc->ec = TALER_EC_RESERVES_POST_UNSUPPORTED_WIRE_METHOD;
+ rc->http_status = MHD_HTTP_CONFLICT;
+ return;
}
+ rc->reserve_expiration
+ = GNUNET_TIME_relative_to_absolute (keys->reserve_closing_delay);
+ rc->payto_uri = GNUNET_strdup (payto_uri);
}
@@ -249,8 +273,8 @@ TMH_private_post_reserves (const struct TMH_RequestHandler
*rh,
if (NULL == rc->payto_uri)
{
return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
-
TALER_EC_RESERVES_POST_UNSUPPORTED_WIRE_METHOD,
+ rc->http_status,
+ rc->ec,
"Exchange does not support wire
method");
}
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] 109/277: commentfix, (continued)
- [taler-merchant] 109/277: commentfix, gnunet, 2020/07/05
- [taler-merchant] 110/277: fix benchmark FTBFS, gnunet, 2020/07/05
- [taler-merchant] 116/277: fix test, gnunet, 2020/07/05
- [taler-merchant] 115/277: misc. fixes, gnunet, 2020/07/05
- [taler-merchant] 91/277: implement GET /orders/ID, gnunet, 2020/07/05
- [taler-merchant] 101/277: more SQL, gnunet, 2020/07/05
- [taler-merchant] 104/277: GET /transfers implementation, gnunet, 2020/07/05
- [taler-merchant] 102/277: towards idempotency in POST /private/transfers, gnunet, 2020/07/05
- [taler-merchant] 103/277: towards GET /transfers, gnunet, 2020/07/05
- [taler-merchant] 114/277: fix sql, gnunet, 2020/07/05
- [taler-merchant] 119/277: better error handling,
gnunet <=
- [taler-merchant] 117/277: get simple pay test to pass, gnunet, 2020/07/05
- [taler-merchant] 94/277: fix ftbfs, gnunet, 2020/07/05
- [taler-merchant] 98/277: implement POST /transfers, gnunet, 2020/07/05
- [taler-merchant] 107/277: implement GET /transfers, gnunet, 2020/07/05
- [taler-merchant] 106/277: implement merchant_api_post_transfers.c, gnunet, 2020/07/05
- [taler-merchant] 111/277: fix link errors in test, gnunet, 2020/07/05
- [taler-merchant] 90/277: starting with get-orders-ID logic, gnunet, 2020/07/05
- [taler-merchant] 92/277: fix backenddb, gnunet, 2020/07/05
- [taler-merchant] 97/277: integrate POST /tranfers handler, gnunet, 2020/07/05
- [taler-merchant] 105/277: API design for /transfers, gnunet, 2020/07/05