gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: deal more nicely with /keys fail


From: gnunet
Subject: [taler-exchange] branch master updated: deal more nicely with /keys failures where no JSON is returned
Date: Thu, 27 May 2021 11:19:59 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 35ce352b deal more nicely with /keys failures where no JSON is returned
35ce352b is described below

commit 35ce352b16cf1b9fa4ea17a272522d43e29f8656
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu May 27 11:19:56 2021 +0200

    deal more nicely with /keys failures where no JSON is returned
---
 src/lib/exchange_api_handle.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 3adef7b4..ddf30f2b 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -1214,11 +1214,34 @@ keys_completed_cb (void *cls,
     exchange->key_data_raw = json_deep_copy (j);
     exchange->retry_delay = GNUNET_TIME_UNIT_ZERO;
     break;
+  case MHD_HTTP_BAD_REQUEST:
+  case MHD_HTTP_UNAUTHORIZED:
+  case MHD_HTTP_FORBIDDEN:
+  case MHD_HTTP_NOT_FOUND:
+    if (NULL == j)
+    {
+      hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      hr.hint = TALER_ErrorCode_get_hint (hr.ec);
+    }
+    else
+    {
+      hr.ec = TALER_JSON_get_error_code (j);
+      hr.hint = TALER_JSON_get_error_hint (j);
+    }
+    break;
   default:
     if (MHD_HTTP_GATEWAY_TIMEOUT == response_code)
       exchange->keys_error_count++;
-    hr.ec = TALER_JSON_get_error_code (j);
-    hr.hint = TALER_JSON_get_error_hint (j);
+    if (NULL == j)
+    {
+      hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      hr.hint = TALER_ErrorCode_get_hint (hr.ec);
+    }
+    else
+    {
+      hr.ec = TALER_JSON_get_error_code (j);
+      hr.hint = TALER_JSON_get_error_hint (j);
+    }
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Unexpected response code %u/%d\n",
                 (unsigned int) response_code,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]