improve logging

This commit is contained in:
Christian Grothoff 2021-06-24 13:17:28 +02:00
parent f078421db8
commit 5d6ec4c744
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 24 additions and 10 deletions

View File

@ -395,11 +395,13 @@ denomination_add_cb (
if (MHD_HTTP_NO_CONTENT != hr->http_status) if (MHD_HTTP_NO_CONTENT != hr->http_status)
{ {
fprintf (stderr, fprintf (stderr,
"Upload failed for command %u with status %u: %s (%s)\n", "Upload failed for command #%u with status %u: %s (%s)\n",
(unsigned int) dar->idx, (unsigned int) dar->idx,
hr->http_status, hr->http_status,
TALER_ErrorCode_get_hint (hr->ec), TALER_ErrorCode_get_hint (hr->ec),
hr->hint); NULL != hr->hint
? hr->hint
: "no hint provided");
global_ret = 42; global_ret = 42;
} }
GNUNET_CONTAINER_DLL_remove (dar_head, GNUNET_CONTAINER_DLL_remove (dar_head,

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015-2020 Taler Systems SA Copyright (C) 2015-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -106,13 +106,25 @@ handle_auditor_add_denomination_finished (void *cls,
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
GNUNET_break_op (0); if (NULL != json)
{
hr.ec = TALER_JSON_get_error_code (json); hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange auditor-add-denomination\n", "Unexpected response code %u/%d for exchange auditor-add-denomination at URL `%s'\n",
(unsigned int) response_code, (unsigned int) response_code,
(int) hr.ec); (int) hr.ec,
ah->url);
}
else
{
hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
hr.hint = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected HTTP response code %u (no JSON returned) at URL `%s'\n",
(unsigned int) response_code,
ah->url);
}
break; break;
} }
if (NULL != ah->cb) if (NULL != ah->cb)