nice error reporting

This commit is contained in:
Christian Grothoff 2015-07-08 09:47:50 +02:00
parent ea5c1233f1
commit 663ea48047
2 changed files with 13 additions and 3 deletions

View File

@ -136,15 +136,26 @@ TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh,
res = TMH_PARSE_json_data (connection, res = TMH_PARSE_json_data (connection,
root, root,
spec); spec);
json_decref (root);
if (GNUNET_OK != res) if (GNUNET_OK != res)
{
json_decref (root);
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
}
if (GNUNET_YES !=
TALER_json_validate_wireformat (TMH_expected_wire_format,
wire))
{
TMH_PARSE_release_data (spec);
return TMH_RESPONSE_reply_arg_unknown (connection,
"wire");
}
res = TMH_DB_execute_admin_add_incoming (connection, res = TMH_DB_execute_admin_add_incoming (connection,
&reserve_pub, &reserve_pub,
&amount, &amount,
at, at,
wire); wire);
TMH_PARSE_release_data (spec); TMH_PARSE_release_data (spec);
json_decref (root);
return res; return res;
} }

View File

@ -299,9 +299,8 @@ TALER_json_to_amount (json_t *json,
{ {
char *json_enc; char *json_enc;
GNUNET_break_op (0);
if (NULL == (json_enc = json_dumps (json, if (NULL == (json_enc = json_dumps (json,
JSON_COMPACT | JSON_SORT_KEYS | JSON_ENCODE_ANY))) JSON_COMPACT | JSON_ENCODE_ANY)))
{ {
GNUNET_break (0); GNUNET_break (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;