From 3c01b3c1d930b61b87053f623beff982042d0ad5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 26 May 2021 09:39:59 +0200 Subject: log exchange status code if operation fails with bad gateway --- src/lib/merchant_api_post_transfers.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/lib') diff --git a/src/lib/merchant_api_post_transfers.c b/src/lib/merchant_api_post_transfers.c index 3a775b90..2e41ebb2 100644 --- a/src/lib/merchant_api_post_transfers.c +++ b/src/lib/merchant_api_post_transfers.c @@ -209,6 +209,39 @@ handle_post_transfers_finished (void *cls, hr.ec = TALER_JSON_get_error_code (json); hr.hint = TALER_JSON_get_error_hint (json); break; + case MHD_HTTP_BAD_GATEWAY: + /* Exchange had an issue; we should retry, but this API + leaves this to the application */ + hr.ec = TALER_JSON_get_error_code (json); + hr.hint = TALER_JSON_get_error_hint (json); + { + uint32_t eec; + uint32_t ehc; + struct GNUNET_JSON_Specification ispec[] = { + GNUNET_JSON_spec_uint32 ("exchange_code", + &eec), + GNUNET_JSON_spec_uint32 ("exchange_http_status", + &ehc), + GNUNET_JSON_spec_end () + }; + + if (GNUNET_OK != + GNUNET_JSON_parse (deposit_sum, + ispec, + NULL, NULL)) + { + GNUNET_break_op (0); + break; + } + else + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Exchange returned %u/%u\n", + (unsigned int) eec, + (unsigned int) ehc); + } + } + break; case MHD_HTTP_GATEWAY_TIMEOUT: /* Server had an internal issue; we should retry, but this API leaves this to the application */ -- cgit v1.2.3