[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: improve error reporting (#6969)
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: improve error reporting (#6969) |
Date: |
Tue, 03 Aug 2021 14:08:49 +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 9da05a19 improve error reporting (#6969)
9da05a19 is described below
commit 9da05a1901fddb26a82fdaf853566c23116800fd
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Aug 3 14:08:45 2021 +0200
improve error reporting (#6969)
---
src/bank-lib/taler-exchange-wire-gateway-client.c | 37 ++++++++++++++-----
src/bank-lib/taler-fakebank-run.c | 44 +++++++++++++++++------
2 files changed, 63 insertions(+), 18 deletions(-)
diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c
b/src/bank-lib/taler-exchange-wire-gateway-client.c
index 935506f7..c69c32c4 100644
--- a/src/bank-lib/taler-exchange-wire-gateway-client.c
+++ b/src/bank-lib/taler-exchange-wire-gateway-client.c
@@ -181,10 +181,20 @@ credit_history_cb (void *cls,
(TALER_EC_NONE != ec) ||
(NULL == details) )
{
- fprintf (stderr,
- "Failed to obtain credit history: %u/%d\n",
- http_status,
- ec);
+ if (0 == http_status)
+ {
+ fprintf (stderr,
+ "Failed to obtain HTTP reply from `%s'\n",
+ auth.wire_gateway_url);
+ }
+ else
+ {
+ fprintf (stderr,
+ "Failed to obtain credit history from `%s': HTTP status %u
(%s)\n",
+ auth.wire_gateway_url,
+ http_status,
+ TALER_ErrorCode_get_hint (ec));
+ }
if (NULL != json)
json_dumpf (json,
stderr,
@@ -277,16 +287,27 @@ debit_history_cb (void *cls,
{
(void) cls;
+ dhh = NULL;
if (MHD_HTTP_OK != http_status)
{
if ( (MHD_HTTP_NO_CONTENT != http_status) ||
(TALER_EC_NONE != ec) ||
(NULL == details) )
{
- fprintf (stderr,
- "Failed to obtain debit history: %u/%d\n",
- http_status,
- ec);
+ if (0 == http_status)
+ {
+ fprintf (stderr,
+ "Failed to obtain HTTP reply from `%s'\n",
+ auth.wire_gateway_url);
+ }
+ else
+ {
+ fprintf (stderr,
+ "Failed to obtain debit history from `%s': HTTP status %u
(%s)\n",
+ auth.wire_gateway_url,
+ http_status,
+ TALER_ErrorCode_get_hint (ec));
+ }
if (NULL != json)
json_dumpf (json,
stderr,
diff --git a/src/bank-lib/taler-fakebank-run.c
b/src/bank-lib/taler-fakebank-run.c
index 5aa8650a..ff9dcc17 100644
--- a/src/bank-lib/taler-fakebank-run.c
+++ b/src/bank-lib/taler-fakebank-run.c
@@ -42,6 +42,25 @@ static int connection_close;
*/
static int ret;
+/**
+ * Handle for the service.
+ */
+static struct TALER_FAKEBANK_Handle *fb;
+
+
+/**
+ * Stop the process.
+ *
+ * @param cls NULL
+ */
+static void
+do_shutdown (void *cls)
+{
+ (void) cls;
+ TALER_FAKEBANK_stop (fb);
+ fb = NULL;
+}
+
/**
* Main function that will be run.
@@ -69,7 +88,7 @@ run (void *cls,
TALER_config_get_currency (cfg,
¤cy_string))
{
- ret = 1;
+ ret = EXIT_NOTCONFIGURED;
return;
}
if (GNUNET_OK !=
@@ -92,15 +111,20 @@ run (void *cls,
"Maximum transaction history in RAM set to default of %llu\n",
ram);
}
- if (NULL ==
- TALER_FAKEBANK_start2 ((uint16_t) port,
- currency_string,
- ram,
- num_threads,
- (0 != connection_close) ))
- ret = 1;
+ fb = TALER_FAKEBANK_start2 ((uint16_t) port,
+ currency_string,
+ ram,
+ num_threads,
+ (0 != connection_close));
+ if (NULL == fb)
+ {
+ ret = EXIT_FAILURE;
+ return;
+ }
GNUNET_free (currency_string);
- ret = 0;
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+ NULL);
+ ret = EXIT_SUCCESS;
}
@@ -135,6 +159,6 @@ main (int argc,
options,
&run,
NULL))
- return 1;
+ return EXIT_INVALIDARGUMENT;
return ret;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: improve error reporting (#6969),
gnunet <=