From 4bba7263564303f45eed86cc68e54bbbf00856a6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 25 Aug 2020 15:11:56 +0200 Subject: nicer generic error reporting logic, for #6432 --- src/exchange/taler-exchange-httpd_reserves_get.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/exchange/taler-exchange-httpd_reserves_get.c') diff --git a/src/exchange/taler-exchange-httpd_reserves_get.c b/src/exchange/taler-exchange-httpd_reserves_get.c index cbc6b422b..2272e6d03 100644 --- a/src/exchange/taler-exchange-httpd_reserves_get.c +++ b/src/exchange/taler-exchange-httpd_reserves_get.c @@ -51,7 +51,7 @@ reply_reserve_history_success (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_RESERVE_STATUS_DB_ERROR, - "balance calculation failure"); + NULL); json_balance = TALER_JSON_from_amount (&balance); return TALER_MHD_reply_json_pack (connection, MHD_HTTP_OK, @@ -143,7 +143,7 @@ TEH_handler_reserves_get (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_RESERVES_INVALID_RESERVE_PUB, - "reserve public key malformed"); + args[0]); } rsc.rh = NULL; if (GNUNET_OK != @@ -156,14 +156,10 @@ TEH_handler_reserves_get (const struct TEH_RequestHandler *rh, /* generate proper response */ if (NULL == rsc.rh) - return TALER_MHD_reply_json_pack (connection, - MHD_HTTP_NOT_FOUND, - "{s:s, s:s, s:I}", - "hint", "Reserve not found", - "parameter", "reserve_pub", - "code", - (json_int_t) - TALER_EC_RESERVE_STATUS_UNKNOWN); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_RESERVE_STATUS_UNKNOWN, + args[0]); mhd_ret = reply_reserve_history_success (connection, rsc.rh); TEH_plugin->free_reserve_history (TEH_plugin->cls, -- cgit v1.2.3