From ea5c1233f13ad3128207b6b84401d8638dbc43e5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 8 Jul 2015 09:40:13 +0200 Subject: nicer error reporting --- src/util/json.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/util/json.c') diff --git a/src/util/json.c b/src/util/json.c index e4b0831a4..004f7734c 100644 --- a/src/util/json.c +++ b/src/util/json.c @@ -297,7 +297,19 @@ TALER_json_to_amount (json_t *json, "fraction", &fraction, "currency", ¤cy)) { + char *json_enc; + GNUNET_break_op (0); + if (NULL == (json_enc = json_dumps (json, + JSON_COMPACT | JSON_SORT_KEYS | JSON_ENCODE_ANY))) + { + GNUNET_break (0); + return GNUNET_SYSERR; + } + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Malformed JSON amount: %s\n", + json_enc); + free (json_enc); return GNUNET_SYSERR; } if ( (value < 0) || @@ -415,7 +427,7 @@ TALER_hash_json (json_t *json, GNUNET_CRYPTO_hash (wire_enc, len, hc); - GNUNET_free (wire_enc); + free (wire_enc); return GNUNET_OK; } -- cgit v1.2.3