aboutsummaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_reserves_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/exchange_api_reserves_get.c')
-rw-r--r--src/lib/exchange_api_reserves_get.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/exchange_api_reserves_get.c b/src/lib/exchange_api_reserves_get.c
index 39932d650..e44eefad6 100644
--- a/src/lib/exchange_api_reserves_get.c
+++ b/src/lib/exchange_api_reserves_get.c
@@ -171,32 +171,42 @@ handle_reserves_get_finished (void *cls,
{
struct TALER_EXCHANGE_ReservesGetHandle *rgh = cls;
const json_t *j = response;
+ enum TALER_ErrorCode ec;
rgh->job = NULL;
switch (response_code)
{
case 0:
+ ec = TALER_EC_INVALID_RESPONSE;
break;
case MHD_HTTP_OK:
+ ec = TALER_EC_NONE;
if (GNUNET_OK !=
handle_reserves_get_ok (rgh,
j))
+ {
response_code = 0;
+ ec = TALER_EC_RESERVE_STATUS_REPLY_MALFORMED;
+ }
break;
case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the exchange is buggy
(or API version conflict); just pass JSON reply to the application */
+ ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_NOT_FOUND:
/* Nothing really to verify, this should never
happen, we should pass the JSON reply to the application */
+ ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_INTERNAL_SERVER_ERROR:
/* Server had an internal issue; we should retry, but this API
leaves this to the application */
+ ec = TALER_JSON_get_error_code (j);
break;
default:
/* unexpected response code */
+ ec = TALER_JSON_get_error_code (j);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u\n",
(unsigned int) response_code);
@@ -208,7 +218,7 @@ handle_reserves_get_finished (void *cls,
{
rgh->cb (rgh->cb_cls,
response_code,
- TALER_JSON_get_error_code (j),
+ ec,
j,
NULL,
0, NULL);