From 4bba7263564303f45eed86cc68e54bbbf00856a6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 25 Aug 2020 15:11:56 +0200 Subject: nicer generic error reporting logic, for #6432 --- src/exchange/taler-exchange-httpd.c | 10 ++-- src/exchange/taler-exchange-httpd_db.c | 12 ++--- src/exchange/taler-exchange-httpd_deposit.c | 24 ++++----- src/exchange/taler-exchange-httpd_deposits_get.c | 16 +++--- src/exchange/taler-exchange-httpd_keystate.c | 10 ++-- src/exchange/taler-exchange-httpd_link.c | 6 +-- src/exchange/taler-exchange-httpd_melt.c | 61 +++++++++++----------- src/exchange/taler-exchange-httpd_recoup.c | 22 ++++---- .../taler-exchange-httpd_refreshes_reveal.c | 53 ++++++++++--------- src/exchange/taler-exchange-httpd_refund.c | 54 +++++++++++-------- src/exchange/taler-exchange-httpd_reserves_get.c | 16 +++--- src/exchange/taler-exchange-httpd_responses.c | 6 +-- src/exchange/taler-exchange-httpd_transfers_get.c | 12 ++--- src/exchange/taler-exchange-httpd_withdraw.c | 48 +++++++++-------- 14 files changed, 181 insertions(+), 169 deletions(-) (limited to 'src/exchange') diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 73cc3530d..bc6ab23b3 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -236,7 +236,7 @@ handle_post_coins (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_COINS_INVALID_COIN_PUB, - "coin public key malformed"); + args[0]); } for (unsigned int i = 0; NULL != h[i].op; i++) if (0 == strcmp (h[i].op, @@ -247,7 +247,7 @@ handle_post_coins (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_OPERATION_UNKNOWN, - "requested operation on coin unknown"); + args[1]); } @@ -331,7 +331,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_URI_TOO_LONG, TALER_EC_URI_TOO_LONG, - "The URI given is too long"); + url); } /* All POST endpoints come with a body in JSON format. So we parse @@ -745,7 +745,7 @@ handle_mhd_request (void *cls, return TALER_MHD_reply_with_error (connection, MHD_HTTP_METHOD_NOT_ALLOWED, TALER_EC_METHOD_INVALID, - "The HTTP method used is invalid for this URL"); + method); } } @@ -756,7 +756,7 @@ handle_mhd_request (void *cls, ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_ENDPOINT_UNKNOWN, - "No handler found for the given URL"); + url); GNUNET_async_scope_restore (&old_scope); return ret; } diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c index b0e495226..505cf3d92 100644 --- a/src/exchange/taler-exchange-httpd_db.c +++ b/src/exchange/taler-exchange-httpd_db.c @@ -74,7 +74,7 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DB_COIN_HISTORY_STORE_ERROR, - "could not persist coin data"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; case TALER_EXCHANGEDB_CKS_CONFLICT: break; @@ -96,7 +96,7 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DEPOSIT_HISTORY_DB_ERROR, - "could not fetch coin transaction history"); + NULL); return qs; } *mhd_ret @@ -146,7 +146,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DB_SETUP_FAILED, - "could not establish database session"); + NULL); return GNUNET_SYSERR; } for (unsigned int retries = 0; @@ -165,7 +165,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DB_START_FAILED, - "could not begin transaction"); + NULL); return GNUNET_SYSERR; } qs = cb (cb_cls, @@ -186,7 +186,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DB_COMMIT_FAILED_HARD, - "could not commit database transaction"); + NULL); return GNUNET_SYSERR; } /* make sure callback did not violate invariants! */ @@ -202,7 +202,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DB_COMMIT_FAILED_ON_RETRY, - "repatedly failed to serialize database transaction"); + NULL); return GNUNET_SYSERR; } diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index 0b810220a..25c3d80cf 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -161,7 +161,7 @@ deposit_precheck (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DEPOSIT_HISTORY_DB_ERROR, - "Could not check for existing identical deposit"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } return qs; @@ -255,7 +255,7 @@ deposit_transaction (void *cls, connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DEPOSIT_HISTORY_DB_ERROR, - "could not fetch coin transaction history"); + NULL); return qs; } if (GNUNET_OK != @@ -269,7 +269,7 @@ deposit_transaction (void *cls, connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DEPOSIT_HISTORY_DB_ERROR, - "could not calculate historic coin amount total"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } /* Check that cost of all transactions (including the current one) is @@ -301,7 +301,7 @@ deposit_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DEPOSIT_STORE_DB_ERROR, - "Could not persist /deposit data"); + NULL); } return qs; } @@ -382,7 +382,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE, - "refund_deadline"); + NULL); } if (GNUNET_OK != TALER_JSON_merchant_wire_signature_hash (wire, @@ -394,7 +394,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_JSON, - "wire"); + NULL); } if (0 != GNUNET_memcmp (&deposit.h_wire, &my_h_wire)) @@ -404,7 +404,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT, - "h_wire"); + NULL); } /* Check for idempotency: did we get this request before? */ @@ -457,7 +457,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, hc, ec, - "Could not find denomination key used in deposit"); + NULL); } TALER_amount_ntoh (&deposit.deposit_fee, &dki->issue.properties.fee_deposit); @@ -471,7 +471,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_DEPOSIT_CURRENCY_MISMATCH, - "contribution"); + deposit.deposit_fee.currency); } /* check coin signature */ if (GNUNET_YES != @@ -484,7 +484,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_UNAUTHORIZED, TALER_EC_DEPOSIT_DENOMINATION_SIGNATURE_INVALID, - "ub_sig"); + NULL); } TALER_amount_ntoh (&dc.value, &dki->issue.properties.value); @@ -498,7 +498,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE, - "deposited amount smaller than depositing fee"); + NULL); } /* check deposit signature */ @@ -530,7 +530,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_UNAUTHORIZED, TALER_EC_DEPOSIT_COIN_SIGNATURE_INVALID, - "coin_sig"); + NULL); } } diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c index a2226b7e3..983177aa3 100644 --- a/src/exchange/taler-exchange-httpd_deposits_get.c +++ b/src/exchange/taler-exchange-httpd_deposits_get.c @@ -234,7 +234,7 @@ deposits_get_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DEPOSITS_GET_DB_FETCH_FAILED, - "failed to fetch transaction data"); + NULL); } return qs; } @@ -243,7 +243,7 @@ deposits_get_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_DEPOSITS_GET_NOT_FOUND, - "transaction unknown"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } return qs; @@ -289,7 +289,7 @@ handle_track_transaction_request ( return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_DEPOSITS_GET_DB_FEE_INCONSISTENT, - "fees are inconsistent"); + NULL); return reply_deposit_details (connection, &tps->h_contract_terms, &tps->h_wire, @@ -333,7 +333,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_DEPOSITS_INVALID_H_WIRE, - "wire hash malformed"); + args[0]); } if (GNUNET_OK != GNUNET_STRINGS_string_to_data (args[1], @@ -345,7 +345,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_DEPOSITS_INVALID_MERCHANT_PUB, - "merchant public key malformed"); + args[1]); } if (GNUNET_OK != GNUNET_STRINGS_string_to_data (args[2], @@ -357,7 +357,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_DEPOSITS_INVALID_H_CONTRACT_TERMS, - "contract terms hash malformed"); + args[2]); } if (GNUNET_OK != GNUNET_STRINGS_string_to_data (args[3], @@ -369,7 +369,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_DEPOSITS_INVALID_COIN_PUB, - "coin public key malformed"); + args[3]); } res = TALER_MHD_parse_request_arg_data (connection, "merchant_sig", @@ -389,7 +389,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID, - "merchant_sig"); + NULL); } return handle_track_transaction_request (connection, diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index 4439bb945..7f0f20125 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -2502,7 +2502,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_KEYS_HAVE_NOT_NUMERIC, - "last_issue_date"); + have_cherrypick); } /* The following multiplication may overflow; but this should not really be a problem, as giving back 'older' data than what the client asks for @@ -2531,7 +2531,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_KEYS_HAVE_NOT_NUMERIC, - "now"); + have_fakenow); } if (TEH_allow_keys_timetravel) { @@ -2547,7 +2547,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_KEYS_TIMETRAVEL_FORBIDDEN, - "timetravel not allowed by this exchange"); + NULL); } } GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -2567,7 +2567,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_EXCHANGE_BAD_CONFIGURATION, - "no keys for requested time"); + NULL); } krd = bsearch (&last_issue_date, key_state->krd_array, @@ -2599,7 +2599,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_KEYS_MISSING, - "no key response found"); + NULL); } ret = MHD_queue_response (connection, MHD_HTTP_OK, diff --git a/src/exchange/taler-exchange-httpd_link.c b/src/exchange/taler-exchange-httpd_link.c index 948c8eb08..3611db50e 100644 --- a/src/exchange/taler-exchange-httpd_link.c +++ b/src/exchange/taler-exchange-httpd_link.c @@ -157,7 +157,7 @@ link_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, ctx->ec, - "coin_pub"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) @@ -165,7 +165,7 @@ link_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_LINK_COIN_UNKNOWN, - "coin_pub"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } return qs; @@ -202,7 +202,7 @@ TEH_handler_link (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_COINS_INVALID_COIN_PUB, - "coin public key malformed"); + args[0]); } ctx.mlist = json_array (); if (NULL == ctx.mlist) diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c index 35cd2359e..4f5f4ceb0 100644 --- a/src/exchange/taler-exchange-httpd_melt.c +++ b/src/exchange/taler-exchange-httpd_melt.c @@ -64,25 +64,25 @@ reply_melt_insufficient_funds ( return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_MELT_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS, - "Failed to compile transaction history"); - return TALER_MHD_reply_json_pack (connection, - MHD_HTTP_CONFLICT, - "{s:s, s:I, s:o, s:o, s:o, s:o, s:o}", - "hint", - "insufficient funds", - "code", - (json_int_t) - TALER_EC_MELT_INSUFFICIENT_FUNDS, - "coin_pub", - GNUNET_JSON_from_data_auto (coin_pub), - "original_value", - TALER_JSON_from_amount (coin_value), - "residual_value", - TALER_JSON_from_amount (residual), - "requested_value", - TALER_JSON_from_amount (requested), - "history", - history); + NULL); + return TALER_MHD_reply_json_pack ( + connection, + MHD_HTTP_CONFLICT, + "{s:s, s:I, s:o, s:o, s:o, s:o, s:o}", + TALER_ErrorCode_get_hint (TALER_EC_MELT_INSUFFICIENT_FUNDS), + "code", + (json_int_t) + TALER_EC_MELT_INSUFFICIENT_FUNDS, + "coin_pub", + GNUNET_JSON_from_data_auto (coin_pub), + "original_value", + TALER_JSON_from_amount (coin_value), + "residual_value", + TALER_JSON_from_amount (residual), + "requested_value", + TALER_JSON_from_amount (requested), + "history", + history); } @@ -202,7 +202,7 @@ refresh_check_melt (struct MHD_Connection *connection, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_MELT_DB_FETCH_ERROR, - "failed to fetch old coin history"); + NULL); return qs; } if (rmc->zombie_required) @@ -229,7 +229,7 @@ refresh_check_melt (struct MHD_Connection *connection, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_MELT_COIN_EXPIRED_NO_ZOMBIE, - "denomination expired"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } } @@ -244,7 +244,7 @@ refresh_check_melt (struct MHD_Connection *connection, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_MELT_COIN_HISTORY_COMPUTATION_FAILED, - "failed to compute coin transaction history"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -341,7 +341,7 @@ melt_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_MELT_DB_FETCH_ERROR, - "failed to fetch melt index"); + NULL); return qs; } @@ -367,7 +367,7 @@ melt_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_MELT_DB_STORE_SESSION_ERROR, - "failed to persist melt data"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } return qs; @@ -417,7 +417,7 @@ handle_melt (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_MELT_COIN_SIGNATURE_INVALID, - "confirm_sig"); + NULL); } } @@ -509,7 +509,7 @@ check_for_denomination_key (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_MELT_DB_FETCH_ERROR, - "failed to find information about old coin"); + NULL); } /* sanity check */ GNUNET_break (0 == @@ -549,7 +549,7 @@ check_for_denomination_key (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, hc, ec, - "unknown denomination"); + NULL); } TALER_amount_ntoh (&rmc->coin_refresh_fee, @@ -566,7 +566,8 @@ check_for_denomination_key (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_MELT_CURRENCY_MISMATCH, - "value_with_fee"); + rmc->refresh_session.amount_with_fee. + currency); } /* check coin is actually properly signed */ @@ -579,7 +580,7 @@ check_for_denomination_key (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_MELT_DENOMINATION_SIGNATURE_INVALID, - "denom_sig"); + NULL); } } TEH_KS_release (key_state); @@ -593,7 +594,7 @@ check_for_denomination_key (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_MELT_FEES_EXCEED_CONTRIBUTION, - "melt amount smaller than melting fee"); + NULL); } return handle_melt (connection, rmc); diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c index e53c1d9d2..74d725653 100644 --- a/src/exchange/taler-exchange-httpd_recoup.c +++ b/src/exchange/taler-exchange-httpd_recoup.c @@ -156,7 +156,7 @@ recoup_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_RECOUP_DB_FETCH_FAILED, - "failed to fetch old coin of blind coin"); + NULL); } return qs; } @@ -175,7 +175,7 @@ recoup_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_RECOUP_DB_FETCH_FAILED, - "failed to fetch reserve of blinded coin"); + NULL); } return qs; } @@ -188,7 +188,7 @@ recoup_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_RECOUP_WITHDRAW_NOT_FOUND, - "envelope unknown"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -206,7 +206,7 @@ recoup_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_RECOUP_DB_FETCH_FAILED, - "failed to fetch coin transaction history"); + NULL); } return qs; } @@ -241,7 +241,7 @@ recoup_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_RECOUP_HISTORY_DB_ERROR, - "failed to calculate old coin transaction history"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -261,7 +261,7 @@ recoup_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_RECOUP_COIN_BALANCE_NEGATIVE, - "calculated negative coin balance"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } if ( (0 == pc->amount.fraction) && @@ -328,7 +328,7 @@ recoup_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_RECOUP_DB_PUT_FAILED, - "failed to persist recoup data"); + NULL); } return qs; } @@ -392,7 +392,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, hc, ec, - "denomination not valid for recoup"); + NULL); } TALER_amount_ntoh (&pc.value, &dki->issue.properties.value); @@ -407,7 +407,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_RECOUP_DENOMINATION_SIGNATURE_INVALID, - "denom_sig"); + NULL); } /* check recoup request signature */ @@ -431,7 +431,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_RECOUP_SIGNATURE_INVALID, - "coin_sig"); + NULL); } } GNUNET_CRYPTO_hash (&coin->coin_pub.eddsa_pub, @@ -449,7 +449,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_RECOUP_BLINDING_FAILED, - "coin_bks"); + NULL); } TEH_KS_release (key_state); } diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index e752ce969..09d1a67b7 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -257,7 +257,7 @@ refreshes_reveal_preflight (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REVEAL_DB_FETCH_REVEAL_ERROR, - "failed to fetch reveal data"); + NULL); rctx->preflight_ok = GNUNET_SYSERR; return GNUNET_DB_STATUS_HARD_ERROR; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: @@ -309,7 +309,7 @@ refreshes_reveal_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_REVEAL_SESSION_UNKNOWN, - "rc"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } if (GNUNET_DB_STATUS_SOFT_ERROR == qs) @@ -321,7 +321,7 @@ refreshes_reveal_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REVEAL_DB_FETCH_SESSION_ERROR, - "failed to fetch valid challenge from database"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -409,16 +409,17 @@ refreshes_reveal_transaction (void *cls, &rc_expected)) { GNUNET_break_op (0); - *mhd_ret = TALER_MHD_reply_json_pack (connection, - MHD_HTTP_CONFLICT, - "{s:s, s:I, s:o}", - "hint", "commitment violation", - "code", - (json_int_t) - TALER_EC_REVEAL_COMMITMENT_VIOLATION, - "rc_expected", - GNUNET_JSON_from_data_auto ( - &rc_expected)); + *mhd_ret = TALER_MHD_reply_json_pack ( + connection, + MHD_HTTP_CONFLICT, + "{s:s, s:I, s:o}", + "hint", + TALER_ErrorCode_get_hint (TALER_EC_REVEAL_COMMITMENT_VIOLATION), + "code", + (json_int_t) TALER_EC_REVEAL_COMMITMENT_VIOLATION, + "rc_expected", + GNUNET_JSON_from_data_auto ( + &rc_expected)); return GNUNET_DB_STATUS_HARD_ERROR; } } /* end of checking "rc_expected" */ @@ -451,7 +452,7 @@ refreshes_reveal_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REVEAL_COST_CALCULATION_OVERFLOW, - "failed to add up refresh costs"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } } @@ -462,7 +463,7 @@ refreshes_reveal_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REVEAL_AMOUNT_INSUFFICIENT, - "melted coin value is insufficient to cover cost of operation"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } } @@ -517,7 +518,7 @@ refreshes_reveal_persist (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REVEAL_DB_COMMIT_ERROR, - "failed to persist reveal data"); + NULL); } return qs; } @@ -582,7 +583,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, return TALER_MHD_reply_with_error (connection, hc, ec, - "failed to find denomination key"); + NULL); } /* #TEH_KS_DKU_WITHDRAW should warrant that we only get denomination keys where we did not yet forget the private key */ @@ -630,13 +631,13 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_REVEAL_SESSION_UNKNOWN, - "rc"); + NULL); break; case GNUNET_DB_STATUS_HARD_ERROR: ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REVEAL_DB_FETCH_SESSION_ERROR, - "failed to fetch session data"); + NULL); break; case GNUNET_DB_STATUS_SOFT_ERROR: default: @@ -644,7 +645,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_INTERNAL_INVARIANT_FAILURE, - "assertion failed (unexpected database serialization error)"); + NULL); break; } goto cleanup; @@ -689,7 +690,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_REVEAL_LINK_SIGNATURE_INVALID, - "link_sig"); + NULL); goto cleanup; } } @@ -716,7 +717,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REVEAL_SIGNING_ERROR, - "internal signing error"); + NULL); goto cleanup; } } @@ -831,7 +832,7 @@ handle_refreshes_reveal_json (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_REVEAL_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE, - "new_denoms_h"); + NULL); } if (json_array_size (new_denoms_h_json) != @@ -945,7 +946,7 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_REVEAL_INVALID_RCH, - "refresh commitment hash malformed"); + args[0]); } if (0 != strcmp (args[1], "reveal")) @@ -954,7 +955,7 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_OPERATION_INVALID, - "expected 'reveal' operation"); + args[1]); } { @@ -979,7 +980,7 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID, - "transfer_privs"); + NULL); } { diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c index 955f1c51d..ea258d1b2 100644 --- a/src/exchange/taler-exchange-httpd_refund.c +++ b/src/exchange/taler-exchange-httpd_refund.c @@ -125,9 +125,9 @@ refund_transaction (void *cls, { if (GNUNET_DB_STATUS_HARD_ERROR == qs) *mhd_ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_REFUND_COIN_NOT_FOUND, - "database transaction failure"); + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_REFUND_DATABASE_LOOKUP_ERROR, + NULL); return qs; } deposit_found = false; @@ -163,7 +163,7 @@ refund_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_GONE, TALER_EC_REFUND_MERCHANT_ALREADY_PAID, - "money already sent to merchant"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -230,9 +230,11 @@ refund_transaction (void *cls, *mhd_ret = TALER_MHD_reply_json_pack ( connection, MHD_HTTP_PRECONDITION_FAILED, - "{s:s, s:I, s:o}", - "hint", + "{s:s, s:s, s:I, s:o}", + "detail", "conflicting refund with different amount but same refund transaction ID", + "hint", TALER_ErrorCode_get_hint ( + TALER_EC_REFUND_INCONSISTENT_AMOUNT), "code", (json_int_t) TALER_EC_REFUND_INCONSISTENT_AMOUNT, "history", TEH_RESPONSE_compile_transaction_history ( &refund->coin.coin_pub, @@ -306,7 +308,7 @@ refund_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_REFUND_DEPOSIT_NOT_FOUND, - "deposit unknown"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -321,7 +323,7 @@ refund_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_REFUND_CURRENCY_MISMATCH, - "currencies involved do not match"); + deposit_total.currency); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -340,13 +342,16 @@ refund_transaction (void *cls, *mhd_ret = TALER_MHD_reply_json_pack ( connection, MHD_HTTP_CONFLICT, - "{s:s, s:I, s:o}", - "hint", + "{s:s, s:s, s:I, s:o}", + "detail", "total amount refunded exceeds total amount deposited for this coin", - "code", (json_int_t) TALER_EC_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT, - "history", TEH_RESPONSE_compile_transaction_history ( - &refund->coin.coin_pub, - tlx)); + "hint", + TALER_ErrorCode_get_hint (TALER_EC_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT), + "code", + (json_int_t) TALER_EC_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT, + "history", + TEH_RESPONSE_compile_transaction_history (&refund->coin.coin_pub, + tlx)); TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tlx); return GNUNET_DB_STATUS_HARD_ERROR; @@ -365,7 +370,7 @@ refund_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REFUND_STORE_DB_ERROR, - "could not persist store information"); + NULL); return qs; } /* Success or soft failure */ @@ -411,7 +416,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_REFUND_MERCHANT_SIGNATURE_INVALID, - "merchant_sig"); + NULL); } } @@ -425,11 +430,18 @@ verify_and_execute_refund (struct MHD_Connection *connection, &denom_hash); if (0 > qs) { + MHD_RESULT res; + char *dhs; + GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_REFUND_COIN_NOT_FOUND, - "denomination of coin to be refunded not found in DB"); + dhs = GNUNET_STRINGS_data_to_string_alloc (&denom_hash, + sizeof (denom_hash)); + res = TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_REFUND_COIN_NOT_FOUND, + dhs); + GNUNET_free (dhs); + return res; } } @@ -465,7 +477,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, hc, ec, - "denomination not found, but coin known"); + NULL); } TALER_amount_ntoh (&refund->details.refund_fee, &dki->issue.properties.fee_refund); diff --git a/src/exchange/taler-exchange-httpd_reserves_get.c b/src/exchange/taler-exchange-httpd_reserves_get.c index cbc6b422b..2272e6d03 100644 --- a/src/exchange/taler-exchange-httpd_reserves_get.c +++ b/src/exchange/taler-exchange-httpd_reserves_get.c @@ -51,7 +51,7 @@ reply_reserve_history_success (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_RESERVE_STATUS_DB_ERROR, - "balance calculation failure"); + NULL); json_balance = TALER_JSON_from_amount (&balance); return TALER_MHD_reply_json_pack (connection, MHD_HTTP_OK, @@ -143,7 +143,7 @@ TEH_handler_reserves_get (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_RESERVES_INVALID_RESERVE_PUB, - "reserve public key malformed"); + args[0]); } rsc.rh = NULL; if (GNUNET_OK != @@ -156,14 +156,10 @@ TEH_handler_reserves_get (const struct TEH_RequestHandler *rh, /* generate proper response */ if (NULL == rsc.rh) - return TALER_MHD_reply_json_pack (connection, - MHD_HTTP_NOT_FOUND, - "{s:s, s:s, s:I}", - "hint", "Reserve not found", - "parameter", "reserve_pub", - "code", - (json_int_t) - TALER_EC_RESERVE_STATUS_UNKNOWN); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_RESERVE_STATUS_UNKNOWN, + args[0]); mhd_ret = reply_reserve_history_success (connection, rsc.rh); TEH_plugin->free_reserve_history (TEH_plugin->cls, diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 4bcb9e7a5..d7d118615 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -445,13 +445,13 @@ TEH_RESPONSE_reply_coin_insufficient_funds ( GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_COIN_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS, - "failed to convert transaction history to JSON"); + TALER_EC_JSON_ALLOCATION_FAILURE, + "Failed to generated proof of insufficient funds"); } return TALER_MHD_reply_json_pack (connection, MHD_HTTP_CONFLICT, "{s:s, s:I, s:o}", - "hint", "insufficient funds", + "hint", TALER_ErrorCode_get_hint (ec), "code", (json_int_t) ec, "history", history); } diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c index 30018a497..7cf37b375 100644 --- a/src/exchange/taler-exchange-httpd_transfers_get.c +++ b/src/exchange/taler-exchange-httpd_transfers_get.c @@ -446,7 +446,7 @@ get_transfer_deposits (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_TRANSFERS_GET_DB_FETCH_FAILED, - "failed to fetch transaction data"); + NULL); } return qs; } @@ -456,7 +456,7 @@ get_transfer_deposits (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_TRANSFERS_GET_DB_INCONSISTENT, - "exchange database internally inconsistent"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } if (GNUNET_NO == ctx->is_valid) @@ -464,7 +464,7 @@ get_transfer_deposits (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_TRANSFERS_GET_WTID_NOT_FOUND, - "wtid"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } qs = TEH_plugin->get_wire_fee (TEH_plugin->cls, @@ -485,7 +485,7 @@ get_transfer_deposits (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_TRANSFERS_GET_WIRE_FEE_NOT_FOUND, - "did not find wire fee"); + NULL); } return qs; } @@ -498,7 +498,7 @@ get_transfer_deposits (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_TRANSFERS_GET_WIRE_FEE_INCONSISTENT, - "could not subtract wire fee"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; @@ -535,7 +535,7 @@ TEH_handler_transfers_get (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_TRANSFERS_INVALID_WTID, - "wire transfer identifier malformed"); + args[0]); } if (GNUNET_OK != TEH_DB_run_transaction (connection, diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index c4c72d6a4..f39f08971 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -66,7 +66,7 @@ reply_withdraw_insufficient_funds ( return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_WITHDRAW_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS, - "reserve balance calculation failure"); + NULL); if (0 != TALER_amount_cmp (&balance, ebalance)) @@ -76,18 +76,20 @@ reply_withdraw_insufficient_funds ( return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_WITHDRAW_RESERVE_BALANCE_CORRUPT, - "internal balance inconsistency error"); + NULL); } - return TALER_MHD_reply_json_pack (connection, - MHD_HTTP_CONFLICT, - "{s:s, s:I, s:o, s:o}", - "hint", "insufficient funds", - "code", - (json_int_t) - TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS, - "balance", TALER_JSON_from_amount ( - &balance), - "history", json_history); + return TALER_MHD_reply_json_pack ( + connection, + MHD_HTTP_CONFLICT, + "{s:s, s:I, s:o, s:o}", + "hint", + TALER_ErrorCode_get_hint (TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS), + "code", + (json_int_t) TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS, + "balance", + TALER_JSON_from_amount (&balance), + "history", + json_history); } @@ -197,7 +199,7 @@ withdraw_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_WITHDRAW_DB_FETCH_ERROR, - "failed to fetch withdraw data"); + NULL); wc->collectable.sig = denom_sig; return qs; } @@ -232,7 +234,7 @@ withdraw_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_WITHDRAW_DB_FETCH_ERROR, - "failed to fetch reserve data"); + NULL); return qs; } if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) @@ -240,7 +242,7 @@ withdraw_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_WITHDRAW_RESERVE_UNKNOWN, - "reserve_pub"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } if (0 < TALER_amount_cmp (&wc->amount_required, @@ -274,7 +276,7 @@ withdraw_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_WITHDRAW_DB_FETCH_ERROR, - "failed to fetch reserve history"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } *mhd_ret = reply_withdraw_insufficient_funds (connection, @@ -299,7 +301,7 @@ withdraw_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_WITHDRAW_SIGNATURE_FAILED, - "Failed to create blind signature"); + NULL); return GNUNET_DB_STATUS_HARD_ERROR; } } @@ -319,7 +321,7 @@ withdraw_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_WITHDRAW_DB_STORE_ERROR, - "failed to persist withdraw data"); + NULL); return qs; } return qs; @@ -370,7 +372,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_RESERVES_INVALID_RESERVE_PUB, - "reserve public key malformed"); + args[0]); } { @@ -408,7 +410,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, hc, ec, - "could not find denomination key"); + NULL); } } GNUNET_assert (NULL != wc.dki->denom_priv.rsa_private_key); @@ -430,7 +432,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_WITHDRAW_AMOUNT_FEE_OVERFLOW, - "amount overflow for value plus withdraw fee"); + NULL); } TALER_amount_hton (&wc.wsrd.amount_with_fee, &wc.amount_required); @@ -459,7 +461,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_WITHDRAW_RESERVE_SIGNATURE_INVALID, - "reserve_sig"); + NULL); } #if OPTIMISTIC_SIGN @@ -476,7 +478,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_WITHDRAW_SIGNATURE_FAILED, - "Failed to sign"); + NULL); } #endif -- cgit v1.2.3