aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-01-10 15:33:52 +0100
committerChristian Grothoff <christian@grothoff.org>2019-01-10 15:33:52 +0100
commit9b683b2ed823e879bf2345cb62204277b1af87dc (patch)
tree1e77a025440648fad649bd6c58eddd987f7c96b4
parent84d4c87774e08a84aa130c2613b9132beaa1484f (diff)
improve logging for reoccurrances of #5492
-rw-r--r--src/backend/taler-merchant-httpd_proposal.c37
-rw-r--r--src/lib/testing_api_cmd_pay.c8
2 files changed, 35 insertions, 10 deletions
diff --git a/src/backend/taler-merchant-httpd_proposal.c b/src/backend/taler-merchant-httpd_proposal.c
index 0ae6dbe8..5a63afde 100644
--- a/src/backend/taler-merchant-httpd_proposal.c
+++ b/src/backend/taler-merchant-httpd_proposal.c
@@ -474,24 +474,45 @@ proposal_put (struct MHD_Connection *connection,
}
{
/* Hard error could be constraint violation, check if order already exists */
- json_t *dummy_contract_terms = NULL;
+ json_t *contract_terms = NULL;
qs = db->find_order (db->cls,
- &dummy_contract_terms,
+ &contract_terms,
order_id,
&mi->pubkey);
- if (NULL != dummy_contract_terms)
- json_decref (dummy_contract_terms);
if (0 < qs)
{
/* Yep, indeed uniqueness constraint violation */
+ int rv;
+ char *msg;
+
GNUNET_JSON_parse_free (spec);
- return TMH_RESPONSE_reply_external_error (connection,
- TALER_EC_PROPOSAL_STORE_DB_ERROR_ALREADY_EXISTS,
- "proposal already exists");
+ GNUNET_asprintf (&msg,
+ "order ID `%s' already exists",
+ order_id);
+ {
+ /* Log plenty of details for the admin */
+ char *js;
+
+ js = json_dumps (contract_terms,
+ JSON_COMPACT);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Order ID `%s' already exists with proposal `%s'\n"),
+ order_id,
+ js);
+ free (js);
+ }
+ json_decref (contract_terms);
+
+ /* contract_terms may be private, only expose duplicate order_id to the network */
+ rv = TMH_RESPONSE_reply_external_error (connection,
+ TALER_EC_PROPOSAL_STORE_DB_ERROR_ALREADY_EXISTS,
+ msg);
+ GNUNET_free (msg);
+ return rv;
}
}
- /* Other hard transaction error */
+ /* Other hard transaction error (disk full, etc.) */
GNUNET_JSON_parse_free (spec);
return TMH_RESPONSE_reply_internal_error (connection,
TALER_EC_PROPOSAL_STORE_DB_ERROR_HARD,
diff --git a/src/lib/testing_api_cmd_pay.c b/src/lib/testing_api_cmd_pay.c
index 6121171e..15e0adac 100644
--- a/src/lib/testing_api_cmd_pay.c
+++ b/src/lib/testing_api_cmd_pay.c
@@ -802,12 +802,16 @@ _pay_run (const char *merchant_url,
&error_name,
&error_line))
{
+ char *js;
+
+ js = json_dumps (contract_terms,
+ JSON_INDENT (1));
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Parser failed on %s:%u for input `%s'\n",
error_name,
error_line,
- json_dumps (contract_terms,
- JSON_INDENT (1)));
+ js);
+ free (js);
GNUNET_break_op (0);
return NULL;
}