From 299b4b78e0e4b8f194d0f0db18e22b540b174b88 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 4 Apr 2020 13:27:46 +0200 Subject: return more error details for /wire and /keys to clients --- src/testing/testing_api_cmd_serialize_keys.c | 2 +- src/testing/testing_api_cmd_wire.c | 5 ++++- src/testing/testing_api_loop.c | 29 ++++++++++++++++++---------- 3 files changed, 24 insertions(+), 12 deletions(-) (limited to 'src/testing') diff --git a/src/testing/testing_api_cmd_serialize_keys.c b/src/testing/testing_api_cmd_serialize_keys.c index 296a2ddc7..8a723c5ba 100644 --- a/src/testing/testing_api_cmd_serialize_keys.c +++ b/src/testing/testing_api_cmd_serialize_keys.c @@ -209,7 +209,7 @@ connect_with_state_run (void *cls, &exchange_url)); is->exchange = TALER_EXCHANGE_connect (is->ctx, exchange_url, - TALER_TESTING_cert_cb, + &TALER_TESTING_cert_cb, cwss, TALER_EXCHANGE_OPTION_DATA, serialized_keys, diff --git a/src/testing/testing_api_cmd_wire.c b/src/testing/testing_api_cmd_wire.c index 2d79a546f..c8946bb93 100644 --- a/src/testing/testing_api_cmd_wire.c +++ b/src/testing/testing_api_cmd_wire.c @@ -77,19 +77,22 @@ struct WireState * @param accounts_len length of the @a accounts array. * @param accounts list of wire accounts of the exchange, * NULL on error. + * @param full_reply the complete response from the exchange */ static void wire_cb (void *cls, unsigned int http_status, enum TALER_ErrorCode ec, unsigned int accounts_len, - const struct TALER_EXCHANGE_WireAccount *accounts) + const struct TALER_EXCHANGE_WireAccount *accounts, + const json_t *full_reply) { struct WireState *ws = cls; struct TALER_TESTING_Command *cmd = &ws->is->commands[ws->is->ip]; struct TALER_Amount expected_fee; (void) ec; + (void) full_reply; TALER_LOG_DEBUG ("Checking parsed /wire response\n"); ws->wh = NULL; if (ws->expected_response_code != http_status) diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index 361fe6305..51cd74a23 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c @@ -570,7 +570,7 @@ struct MainContext * respective handler by writing to the trigger pipe. */ static void -sighandler_child_death () +sighandler_child_death (void) { static char c; int old_errno = errno; /* back-up errno */ @@ -591,24 +591,31 @@ sighandler_child_death () * all the commands to be run, and a closure for it. * @param keys the exchange's keys. * @param compat protocol compatibility information. + * @param ec error code, #TALER_EC_NONE on success + * @param http_status status returned by /keys, #MHD_HTTP_OK on success + * @param full_reply JSON body of /keys request, NULL if reply was not in JSON */ void TALER_TESTING_cert_cb (void *cls, const struct TALER_EXCHANGE_Keys *keys, - enum TALER_EXCHANGE_VersionCompatibility compat) + enum TALER_EXCHANGE_VersionCompatibility compat, + enum TALER_ErrorCode ec, + unsigned int http_status, + const json_t *full_reply) { struct MainContext *main_ctx = cls; struct TALER_TESTING_Interpreter *is = main_ctx->is; (void) compat; + (void) full_reply; if (NULL == keys) { if (GNUNET_NO == is->working) { - GNUNET_log - (GNUNET_ERROR_TYPE_WARNING, - "Got NULL response for /keys" - " during startup, retrying!\n"); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Got NULL response for /keys during startup (%u/%d), retrying!\n", + http_status, + (int) ec); TALER_EXCHANGE_disconnect (is->exchange); GNUNET_assert (NULL != (is->exchange = TALER_EXCHANGE_connect @@ -620,10 +627,12 @@ TALER_TESTING_cert_cb (void *cls, return; } else - GNUNET_log - (GNUNET_ERROR_TYPE_ERROR, - "Got NULL response for /keys" - " during execution!\n"); + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Got NULL response for /keys during execution (%u/%d)!\n", + http_status, + (int) ec); + } } else { -- cgit v1.2.3