summaryrefslogtreecommitdiff
path: root/src/util/json.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-07-08 09:40:13 +0200
committerChristian Grothoff <christian@grothoff.org>2015-07-08 09:40:13 +0200
commitea5c1233f13ad3128207b6b84401d8638dbc43e5 (patch)
tree4ee2fc37580df6079af9acb339de804ee38846d7 /src/util/json.c
parent296e27b92ab0367f414dc0e98b185531c8df06f3 (diff)
downloadexchange-ea5c1233f13ad3128207b6b84401d8638dbc43e5.tar.gz
exchange-ea5c1233f13ad3128207b6b84401d8638dbc43e5.tar.bz2
exchange-ea5c1233f13ad3128207b6b84401d8638dbc43e5.zip
nicer error reporting
Diffstat (limited to 'src/util/json.c')
-rw-r--r--src/util/json.c14
1 files changed, 13 insertions, 1 deletions
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", &currency))
{
+ 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;
}