aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-03 14:08:45 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-03 14:08:45 +0200
commit9da05a1901fddb26a82fdaf853566c23116800fd (patch)
tree717207f2206f288439884e6b9ef119fb71326726
parent0ce92c840281f750fa97451871d28e9855a0ce89 (diff)
downloadexchange-9da05a1901fddb26a82fdaf853566c23116800fd.tar.gz
exchange-9da05a1901fddb26a82fdaf853566c23116800fd.zip
improve error reporting (#6969)
-rw-r--r--src/bank-lib/taler-exchange-wire-gateway-client.c37
-rw-r--r--src/bank-lib/taler-fakebank-run.c44
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 935506f71..c69c32c47 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,
181 (TALER_EC_NONE != ec) || 181 (TALER_EC_NONE != ec) ||
182 (NULL == details) ) 182 (NULL == details) )
183 { 183 {
184 fprintf (stderr, 184 if (0 == http_status)
185 "Failed to obtain credit history: %u/%d\n", 185 {
186 http_status, 186 fprintf (stderr,
187 ec); 187 "Failed to obtain HTTP reply from `%s'\n",
188 auth.wire_gateway_url);
189 }
190 else
191 {
192 fprintf (stderr,
193 "Failed to obtain credit history from `%s': HTTP status %u (%s)\n",
194 auth.wire_gateway_url,
195 http_status,
196 TALER_ErrorCode_get_hint (ec));
197 }
188 if (NULL != json) 198 if (NULL != json)
189 json_dumpf (json, 199 json_dumpf (json,
190 stderr, 200 stderr,
@@ -277,16 +287,27 @@ debit_history_cb (void *cls,
277{ 287{
278 (void) cls; 288 (void) cls;
279 289
290 dhh = NULL;
280 if (MHD_HTTP_OK != http_status) 291 if (MHD_HTTP_OK != http_status)
281 { 292 {
282 if ( (MHD_HTTP_NO_CONTENT != http_status) || 293 if ( (MHD_HTTP_NO_CONTENT != http_status) ||
283 (TALER_EC_NONE != ec) || 294 (TALER_EC_NONE != ec) ||
284 (NULL == details) ) 295 (NULL == details) )
285 { 296 {
286 fprintf (stderr, 297 if (0 == http_status)
287 "Failed to obtain debit history: %u/%d\n", 298 {
288 http_status, 299 fprintf (stderr,
289 ec); 300 "Failed to obtain HTTP reply from `%s'\n",
301 auth.wire_gateway_url);
302 }
303 else
304 {
305 fprintf (stderr,
306 "Failed to obtain debit history from `%s': HTTP status %u (%s)\n",
307 auth.wire_gateway_url,
308 http_status,
309 TALER_ErrorCode_get_hint (ec));
310 }
290 if (NULL != json) 311 if (NULL != json)
291 json_dumpf (json, 312 json_dumpf (json,
292 stderr, 313 stderr,
diff --git a/src/bank-lib/taler-fakebank-run.c b/src/bank-lib/taler-fakebank-run.c
index 5aa8650a0..ff9dcc17c 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;
42 */ 42 */
43static int ret; 43static int ret;
44 44
45/**
46 * Handle for the service.
47 */
48static struct TALER_FAKEBANK_Handle *fb;
49
50
51/**
52 * Stop the process.
53 *
54 * @param cls NULL
55 */
56static void
57do_shutdown (void *cls)
58{
59 (void) cls;
60 TALER_FAKEBANK_stop (fb);
61 fb = NULL;
62}
63
45 64
46/** 65/**
47 * Main function that will be run. 66 * Main function that will be run.
@@ -69,7 +88,7 @@ run (void *cls,
69 TALER_config_get_currency (cfg, 88 TALER_config_get_currency (cfg,
70 &currency_string)) 89 &currency_string))
71 { 90 {
72 ret = 1; 91 ret = EXIT_NOTCONFIGURED;
73 return; 92 return;
74 } 93 }
75 if (GNUNET_OK != 94 if (GNUNET_OK !=
@@ -92,15 +111,20 @@ run (void *cls,
92 "Maximum transaction history in RAM set to default of %llu\n", 111 "Maximum transaction history in RAM set to default of %llu\n",
93 ram); 112 ram);
94 } 113 }
95 if (NULL == 114 fb = TALER_FAKEBANK_start2 ((uint16_t) port,
96 TALER_FAKEBANK_start2 ((uint16_t) port, 115 currency_string,
97 currency_string, 116 ram,
98 ram, 117 num_threads,
99 num_threads, 118 (0 != connection_close));
100 (0 != connection_close) )) 119 if (NULL == fb)
101 ret = 1; 120 {
121 ret = EXIT_FAILURE;
122 return;
123 }
102 GNUNET_free (currency_string); 124 GNUNET_free (currency_string);
103 ret = 0; 125 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
126 NULL);
127 ret = EXIT_SUCCESS;
104} 128}
105 129
106 130
@@ -135,6 +159,6 @@ main (int argc,
135 options, 159 options,
136 &run, 160 &run,
137 NULL)) 161 NULL))
138 return 1; 162 return EXIT_INVALIDARGUMENT;
139 return ret; 163 return ret;
140} 164}