From 8d312562bf04eeb2afac53a2f24624f8e48529bd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 7 Nov 2020 18:51:14 +0100 Subject: adjust ECs --- .../taler-auditor-httpd_deposit-confirmation.c | 16 +++--- src/auditor/taler-auditor-httpd_exchanges.c | 6 +-- src/auditor/taler-auditor.in | 0 src/bank-lib/bank_api_admin.c | 4 +- src/bank-lib/bank_api_credit.c | 4 +- src/bank-lib/bank_api_debit.c | 4 +- src/bank-lib/bank_api_transfer.c | 4 +- src/exchange/taler-exchange-httpd.c | 12 ++--- src/exchange/taler-exchange-httpd_db.c | 14 +++--- src/exchange/taler-exchange-httpd_deposit.c | 28 +++++------ src/exchange/taler-exchange-httpd_deposits_get.c | 20 ++++---- src/exchange/taler-exchange-httpd_keystate.c | 52 +++++--------------- src/exchange/taler-exchange-httpd_link.c | 8 +-- src/exchange/taler-exchange-httpd_melt.c | 47 +++++++++--------- src/exchange/taler-exchange-httpd_recoup.c | 34 ++++++------- .../taler-exchange-httpd_refreshes_reveal.c | 57 +++++++++++----------- src/exchange/taler-exchange-httpd_refund.c | 35 ++++++------- src/exchange/taler-exchange-httpd_reserves_get.c | 6 +-- src/exchange/taler-exchange-httpd_responses.c | 2 +- src/exchange/taler-exchange-httpd_transfers_get.c | 22 ++++----- src/exchange/taler-exchange-httpd_withdraw.c | 40 +++++++-------- src/json/json.c | 2 +- src/lib/auditor_api_deposit_confirmation.c | 2 +- src/lib/auditor_api_exchanges.c | 8 +-- src/lib/auditor_api_handle.c | 8 +-- src/lib/exchange_api_deposit.c | 10 ++-- src/lib/exchange_api_deposits_get.c | 8 +-- src/lib/exchange_api_handle.c | 2 +- src/lib/exchange_api_link.c | 4 +- src/lib/exchange_api_melt.c | 18 +++---- src/lib/exchange_api_recoup.c | 19 ++++---- src/lib/exchange_api_refreshes_reveal.c | 4 +- src/lib/exchange_api_refund.c | 8 +-- src/lib/exchange_api_reserves_get.c | 4 +- src/lib/exchange_api_transfers_get.c | 4 +- src/lib/exchange_api_wire.c | 16 +++--- src/lib/exchange_api_withdraw.c | 2 +- src/lib/exchange_api_withdraw2.c | 6 +-- src/mhd/mhd_parsing.c | 27 +++++----- .../testing_api_cmd_auditor_deposit_confirmation.c | 4 +- src/testing/testing_api_cmd_auditor_exchanges.c | 4 +- .../testing_api_cmd_bank_admin_add_incoming.c | 4 +- src/testing/testing_api_cmd_bank_transfer.c | 4 +- src/testing/testing_api_cmd_deposit.c | 4 +- src/testing/testing_api_cmd_refresh.c | 12 ++--- src/testing/testing_api_cmd_withdraw.c | 12 ++--- 46 files changed, 291 insertions(+), 320 deletions(-) mode change 100755 => 100644 src/auditor/taler-auditor.in (limited to 'src') diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c b/src/auditor/taler-auditor-httpd_deposit-confirmation.c index 7ee5ead43..67bac1b79 100644 --- a/src/auditor/taler-auditor-httpd_deposit-confirmation.c +++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.c @@ -85,7 +85,7 @@ verify_and_execute_deposit_confirmation ( TALER_LOG_WARNING ("Expired exchange signing key\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID, + TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID, "master signature expired"); } @@ -104,7 +104,7 @@ verify_and_execute_deposit_confirmation ( GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DB_SETUP_FAILED, + TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } if (! cached) @@ -119,7 +119,7 @@ verify_and_execute_deposit_confirmation ( TALER_LOG_WARNING ("Invalid signature on exchange signing key\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID, + TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID, "master signature invalid"); } @@ -133,8 +133,8 @@ verify_and_execute_deposit_confirmation ( TALER_LOG_WARNING ("Failed to store exchange signing key in database\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_AUDITOR_EXCHANGE_STORE_DB_ERROR, - NULL); + TALER_EC_GENERIC_DB_STORE_FAILED, + "exchange signing key"); } /* Cache it, due to concurreny it might already be in the cache, @@ -173,7 +173,7 @@ verify_and_execute_deposit_confirmation ( "Invalid signature on /deposit-confirmation request\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID, + TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID, "exchange signature invalid"); } } @@ -188,8 +188,8 @@ verify_and_execute_deposit_confirmation ( TALER_LOG_WARNING ("Failed to store /deposit-confirmation in database\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DEPOSIT_CONFIRMATION_STORE_DB_ERROR, - NULL); + TALER_EC_GENERIC_DB_STORE_FAILED, + "deposit confirmation"); } return TALER_MHD_reply_json_pack (connection, MHD_HTTP_OK, diff --git a/src/auditor/taler-auditor-httpd_exchanges.c b/src/auditor/taler-auditor-httpd_exchanges.c index ffa215ec2..be627ba1c 100644 --- a/src/auditor/taler-auditor-httpd_exchanges.c +++ b/src/auditor/taler-auditor-httpd_exchanges.c @@ -89,7 +89,7 @@ TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh, GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DB_SETUP_FAILED, + TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } ja = json_array (); @@ -105,8 +105,8 @@ TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh, TALER_LOG_WARNING ("Failed to handle /exchanges in database\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_LIST_EXCHANGES_DB_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "exchanges"); } return TALER_MHD_reply_json_pack (connection, MHD_HTTP_OK, diff --git a/src/auditor/taler-auditor.in b/src/auditor/taler-auditor.in old mode 100755 new mode 100644 diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c index 952daca79..a0d68de2d 100644 --- a/src/bank-lib/bank_api_admin.c +++ b/src/bank-lib/bank_api_admin.c @@ -84,7 +84,7 @@ handle_admin_add_incoming_finished (void *cls, switch (response_code) { case 0: - ec = TALER_EC_INVALID_RESPONSE; + ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: { @@ -103,7 +103,7 @@ handle_admin_add_incoming_finished (void *cls, { GNUNET_break_op (0); response_code = 0; - ec = TALER_EC_INVALID_RESPONSE; + ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; } ec = TALER_EC_NONE; diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c index 8eba7f5f9..578d86c90 100644 --- a/src/bank-lib/bank_api_credit.c +++ b/src/bank-lib/bank_api_credit.c @@ -152,7 +152,7 @@ handle_credit_history_finished (void *cls, switch (response_code) { case 0: - ec = TALER_EC_INVALID_RESPONSE; + ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: if (GNUNET_OK != @@ -161,7 +161,7 @@ handle_credit_history_finished (void *cls, { GNUNET_break_op (0); response_code = 0; - ec = TALER_EC_INVALID_RESPONSE; + ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; } response_code = MHD_HTTP_NO_CONTENT; /* signal end of list */ diff --git a/src/bank-lib/bank_api_debit.c b/src/bank-lib/bank_api_debit.c index 217685dd4..604e89b44 100644 --- a/src/bank-lib/bank_api_debit.c +++ b/src/bank-lib/bank_api_debit.c @@ -154,7 +154,7 @@ handle_debit_history_finished (void *cls, switch (response_code) { case 0: - ec = TALER_EC_INVALID_RESPONSE; + ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: if (GNUNET_OK != @@ -163,7 +163,7 @@ handle_debit_history_finished (void *cls, { GNUNET_break_op (0); response_code = 0; - ec = TALER_EC_INVALID_RESPONSE; + ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; } response_code = MHD_HTTP_NO_CONTENT; /* signal end of list */ diff --git a/src/bank-lib/bank_api_transfer.c b/src/bank-lib/bank_api_transfer.c index 60a7b1b66..3f482e8c4 100644 --- a/src/bank-lib/bank_api_transfer.c +++ b/src/bank-lib/bank_api_transfer.c @@ -177,7 +177,7 @@ handle_transfer_finished (void *cls, switch (response_code) { case 0: - ec = TALER_EC_INVALID_RESPONSE; + ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: { @@ -196,7 +196,7 @@ handle_transfer_finished (void *cls, { GNUNET_break_op (0); response_code = 0; - ec = TALER_EC_INVALID_RESPONSE; + ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; } ec = TALER_EC_NONE; diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index aa477eb2b..1faea14fa 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -235,7 +235,7 @@ handle_post_coins (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_COINS_INVALID_COIN_PUB, + TALER_EC_EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB, args[0]); } for (unsigned int i = 0; NULL != h[i].op; i++) @@ -246,7 +246,7 @@ handle_post_coins (const struct TEH_RequestHandler *rh, root); return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_OPERATION_UNKNOWN, + TALER_EC_EXCHANGE_GENERIC_OPERATION_UNKNOWN, args[1]); } @@ -330,7 +330,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_URI_TOO_LONG, - TALER_EC_URI_TOO_LONG, + TALER_EC_GENERIC_URI_TOO_LONG, url); } @@ -399,7 +399,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh, json_decref (root); return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_WRONG_NUMBER_OF_SEGMENTS, + TALER_EC_EXCHANGE_GENERIC_WRONG_NUMBER_OF_SEGMENTS, emsg); } } @@ -744,7 +744,7 @@ handle_mhd_request (void *cls, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_METHOD_NOT_ALLOWED, - TALER_EC_METHOD_INVALID, + TALER_EC_GENERIC_METHOD_INVALID, method); } } @@ -755,7 +755,7 @@ handle_mhd_request (void *cls, ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_ENDPOINT_UNKNOWN, + TALER_EC_GENERIC_ENDPOINT_UNKNOWN, 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 505cf3d92..14a5b5d5b 100644 --- a/src/exchange/taler-exchange-httpd_db.c +++ b/src/exchange/taler-exchange-httpd_db.c @@ -73,7 +73,7 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DB_COIN_HISTORY_STORE_ERROR, + TALER_EC_GENERIC_DB_STORE_FAILED, NULL); return GNUNET_DB_STATUS_HARD_ERROR; case TALER_EXCHANGEDB_CKS_CONFLICT: @@ -95,14 +95,14 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, *mhd_ret = TALER_MHD_reply_with_error ( connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DEPOSIT_HISTORY_DB_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, NULL); return qs; } *mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds ( connection, - TALER_EC_COIN_CONFLICTING_DENOMINATION_KEY, + TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY, &coin->coin_pub, tl); TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, @@ -145,7 +145,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, if (NULL != mhd_ret) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DB_SETUP_FAILED, + TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); return GNUNET_SYSERR; } @@ -164,7 +164,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, if (NULL != mhd_ret) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DB_START_FAILED, + TALER_EC_GENERIC_DB_START_FAILED, NULL); return GNUNET_SYSERR; } @@ -185,7 +185,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, if (NULL != mhd_ret) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DB_COMMIT_FAILED_HARD, + TALER_EC_GENERIC_DB_COMMIT_FAILED, NULL); return GNUNET_SYSERR; } @@ -201,7 +201,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, if (NULL != mhd_ret) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DB_COMMIT_FAILED_ON_RETRY, + TALER_EC_GENERIC_DB_SOFT_FAILURE, NULL); return GNUNET_SYSERR; } diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index 25c3d80cf..bd38c6256 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -85,7 +85,7 @@ reply_deposit_success (struct MHD_Connection *connection, { return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no keys"); } return TALER_MHD_reply_json_pack ( @@ -160,7 +160,7 @@ deposit_precheck (void *cls, { *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DEPOSIT_HISTORY_DB_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -254,7 +254,7 @@ deposit_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error ( connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DEPOSIT_HISTORY_DB_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, NULL); return qs; } @@ -268,7 +268,7 @@ deposit_transaction (void *cls, *mhd_ret = TALER_MHD_reply_with_error ( connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DEPOSIT_HISTORY_DB_ERROR, + TALER_EC_GENERIC_DB_INVARIANT_FAILURE, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -280,7 +280,7 @@ deposit_transaction (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deposited coin has insufficient funds left!\n"); *mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection, - TALER_EC_DEPOSIT_INSUFFICIENT_FUNDS, + TALER_EC_EXCHANGE_DEPOSIT_INSUFFICIENT_FUNDS, &deposit->coin. coin_pub, tl); @@ -300,7 +300,7 @@ deposit_transaction (void *cls, TALER_LOG_WARNING ("Failed to store /deposit information in database\n"); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DEPOSIT_STORE_DB_ERROR, + TALER_EC_GENERIC_DB_STORE_FAILED, NULL); } return qs; @@ -381,7 +381,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE, + TALER_EC_EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE, NULL); } if (GNUNET_OK != @@ -393,7 +393,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_JSON, + TALER_EC_EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_JSON, NULL); } if (0 != GNUNET_memcmp (&deposit.h_wire, @@ -403,7 +403,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT, + TALER_EC_EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT, NULL); } @@ -441,7 +441,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no keys"); } dki = TEH_KS_denomination_key_lookup_by_hash (key_state, @@ -470,7 +470,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_DEPOSIT_CURRENCY_MISMATCH, + TALER_EC_GENERIC_CURRENCY_MISMATCH, deposit.deposit_fee.currency); } /* check coin signature */ @@ -483,7 +483,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_UNAUTHORIZED, - TALER_EC_DEPOSIT_DENOMINATION_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_DENOMINATION_SIGNATURE_INVALID, NULL); } TALER_amount_ntoh (&dc.value, @@ -497,7 +497,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE, + TALER_EC_EXCHANGE_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE, NULL); } @@ -529,7 +529,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_UNAUTHORIZED, - TALER_EC_DEPOSIT_COIN_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_DEPOSIT_COIN_SIGNATURE_INVALID, NULL); } } diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c index 983177aa3..5b75bdcfd 100644 --- a/src/exchange/taler-exchange-httpd_deposits_get.c +++ b/src/exchange/taler-exchange-httpd_deposits_get.c @@ -75,7 +75,7 @@ reply_deposit_details (struct MHD_Connection *connection, { return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no keys"); } return TALER_MHD_reply_json_pack (connection, @@ -233,7 +233,7 @@ deposits_get_transaction (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DEPOSITS_GET_DB_FETCH_FAILED, + TALER_EC_GENERIC_DB_FETCH_FAILED, NULL); } return qs; @@ -242,7 +242,7 @@ deposits_get_transaction (void *cls, { *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_DEPOSITS_GET_NOT_FOUND, + TALER_EC_EXCHANGE_DEPOSITS_GET_NOT_FOUND, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -288,8 +288,8 @@ handle_track_transaction_request ( if (GNUNET_SYSERR == ctx.pending) return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_DEPOSITS_GET_DB_FEE_INCONSISTENT, - NULL); + TALER_EC_GENERIC_DB_INVARIANT_FAILURE, + "wire fees exceed aggregate in database"); return reply_deposit_details (connection, &tps->h_contract_terms, &tps->h_wire, @@ -332,7 +332,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_DEPOSITS_INVALID_H_WIRE, + TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE, args[0]); } if (GNUNET_OK != @@ -344,7 +344,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_DEPOSITS_INVALID_MERCHANT_PUB, + TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB, args[1]); } if (GNUNET_OK != @@ -356,7 +356,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_DEPOSITS_INVALID_H_CONTRACT_TERMS, + TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS, args[2]); } if (GNUNET_OK != @@ -368,7 +368,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_DEPOSITS_INVALID_COIN_PUB, + TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB, args[3]); } res = TALER_MHD_parse_request_arg_data (connection, @@ -388,7 +388,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID, NULL); } diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index e963928db..9491234e9 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -2029,21 +2029,7 @@ TEH_KS_denomination_key_lookup_by_hash ( if (NULL == dki) { *hc = MHD_HTTP_NOT_FOUND; - switch (use) - { - case TEH_KS_DKU_RECOUP: - *ec = TALER_EC_RECOUP_DENOMINATION_KEY_UNKNOWN; - break; - case TEH_KS_DKU_ZOMBIE: - *ec = TALER_EC_REFRESH_RECOUP_DENOMINATION_KEY_NOT_FOUND; - break; - case TEH_KS_DKU_WITHDRAW: - *ec = TALER_EC_WITHDRAW_DENOMINATION_KEY_NOT_FOUND; - break; - case TEH_KS_DKU_DEPOSIT: - *ec = TALER_EC_DEPOSIT_DENOMINATION_KEY_UNKNOWN; - break; - } + *ec = TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN; return NULL; } now = GNUNET_TIME_absolute_get (); @@ -2054,21 +2040,7 @@ TEH_KS_denomination_key_lookup_by_hash ( "Not returning DKI for %s, as start time is in the future\n", GNUNET_h2s (denom_pub_hash)); *hc = MHD_HTTP_PRECONDITION_FAILED; - switch (use) - { - case TEH_KS_DKU_RECOUP: - *ec = TALER_EC_RECOUP_DENOMINATION_VALIDITY_IN_FUTURE; - break; - case TEH_KS_DKU_ZOMBIE: - *ec = TALER_EC_REFRESH_RECOUP_DENOMINATION_VALIDITY_IN_FUTURE; - break; - case TEH_KS_DKU_WITHDRAW: - *ec = TALER_EC_WITHDRAW_VALIDITY_IN_FUTURE; - break; - case TEH_KS_DKU_DEPOSIT: - *ec = TALER_EC_DEPOSIT_DENOMINATION_VALIDITY_IN_FUTURE; - break; - } + *ec = TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE; return NULL; } now = GNUNET_TIME_absolute_get (); @@ -2082,7 +2054,7 @@ TEH_KS_denomination_key_lookup_by_hash ( GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Not returning DKI for %s, as time to create coins has passed\n", GNUNET_h2s (denom_pub_hash)); - *ec = TALER_EC_WITHDRAW_VALIDITY_IN_PAST; + *ec = TALER_EC_EXCHANGE_WITHDRAW_VALIDITY_IN_PAST; *hc = MHD_HTTP_GONE; return NULL; } @@ -2091,7 +2063,7 @@ TEH_KS_denomination_key_lookup_by_hash ( GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Not returning DKI of %s for WITHDRAW operation as we lack the private key, even though the withdraw period did not yet expire!\n", GNUNET_h2s (denom_pub_hash)); - *ec = TALER_EC_DENOMINATION_KEY_LOST; + *ec = TALER_EC_EXCHANGE_WITHDRAW_DENOMINATION_KEY_LOST; *hc = MHD_HTTP_SERVICE_UNAVAILABLE; return NULL; } @@ -2104,7 +2076,7 @@ TEH_KS_denomination_key_lookup_by_hash ( GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Not returning DKI for %s, as time to spend coin has passed\n", GNUNET_h2s (denom_pub_hash)); - *ec = TALER_EC_DEPOSIT_DENOMINATION_EXPIRED; + *ec = TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED; *hc = MHD_HTTP_GONE; return NULL; } @@ -2117,7 +2089,7 @@ TEH_KS_denomination_key_lookup_by_hash ( GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Not returning DKI for %s, as time to recoup coin has passed\n", GNUNET_h2s (denom_pub_hash)); - *ec = TALER_EC_REFRESH_RECOUP_DENOMINATION_EXPIRED; + *ec = TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED; *hc = MHD_HTTP_GONE; return NULL; } @@ -2130,7 +2102,7 @@ TEH_KS_denomination_key_lookup_by_hash ( GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Not returning DKI for %s, as legal expiration of coin has passed\n", GNUNET_h2s (denom_pub_hash)); - *ec = TALER_EC_REFRESH_ZOMBIE_DENOMINATION_EXPIRED; + *ec = TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED; *hc = MHD_HTTP_GONE; return NULL; } @@ -2501,7 +2473,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_KEYS_HAVE_NOT_NUMERIC, // FIXME: use more GENERIC code! + TALER_EC_GENERIC_PARAMETER_MALFORMED, have_cherrypick); } /* The following multiplication may overflow; but this should not really @@ -2530,7 +2502,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_KEYS_HAVE_NOT_NUMERIC, // FIXME: use more GENERIC code! + TALER_EC_GENERIC_PARAMETER_MALFORMED, have_fakenow); } if (TEH_allow_keys_timetravel) @@ -2546,7 +2518,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, /* Option not allowed by configuration */ return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_KEYS_TIMETRAVEL_FORBIDDEN, + TALER_EC_EXCHANGE_KEYS_TIMETRAVEL_FORBIDDEN, NULL); } } @@ -2566,7 +2538,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, to be our fault, so let's speculatively assume we are to blame ;-) */ return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, NULL); } krd = bsearch (&last_issue_date, @@ -2598,7 +2570,7 @@ TEH_handler_keys (const struct TEH_RequestHandler *rh, TEH_KS_release (key_state); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_KEYS_MISSING, + TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, NULL); } ret = MHD_queue_response (connection, diff --git a/src/exchange/taler-exchange-httpd_link.c b/src/exchange/taler-exchange-httpd_link.c index 3611db50e..1ad5eff09 100644 --- a/src/exchange/taler-exchange-httpd_link.c +++ b/src/exchange/taler-exchange-httpd_link.c @@ -116,7 +116,7 @@ handle_link_data (void *cls, } return; fail: - ctx->ec = TALER_EC_JSON_ALLOCATION_FAILURE; + ctx->ec = TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE; json_decref (ctx->mlist); ctx->mlist = NULL; } @@ -164,7 +164,7 @@ link_transaction (void *cls, { *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_LINK_COIN_UNKNOWN, + TALER_EC_EXCHANGE_LINK_COIN_UNKNOWN, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -201,7 +201,7 @@ TEH_handler_link (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_COINS_INVALID_COIN_PUB, + TALER_EC_EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB, args[0]); } ctx.mlist = json_array (); @@ -210,7 +210,7 @@ TEH_handler_link (const struct TEH_RequestHandler *rh, GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_JSON_ALLOCATION_FAILURE, + TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE, "json_array() call failed"); } if (GNUNET_OK != diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c index 872389543..8b5914e2d 100644 --- a/src/exchange/taler-exchange-httpd_melt.c +++ b/src/exchange/taler-exchange-httpd_melt.c @@ -63,16 +63,16 @@ reply_melt_insufficient_funds ( if (NULL == history) return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_MELT_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS, + TALER_EC_EXCHANGE_MELT_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS, 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}", "hint", - TALER_ErrorCode_get_hint (TALER_EC_MELT_INSUFFICIENT_FUNDS), + TALER_ErrorCode_get_hint (TALER_EC_EXCHANGE_MELT_INSUFFICIENT_FUNDS), "code", - (json_int_t) TALER_EC_MELT_INSUFFICIENT_FUNDS, + (json_int_t) TALER_EC_EXCHANGE_MELT_INSUFFICIENT_FUNDS, "coin_pub", GNUNET_JSON_from_data_auto (coin_pub), "original_value", @@ -115,7 +115,7 @@ reply_melt_success (struct MHD_Connection *connection, { return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no keys"); } return TALER_MHD_reply_json_pack ( @@ -201,8 +201,8 @@ refresh_check_melt (struct MHD_Connection *connection, if (GNUNET_DB_STATUS_HARD_ERROR == qs) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_MELT_DB_FETCH_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "coin transaction history"); return qs; } if (rmc->zombie_required) @@ -228,7 +228,7 @@ refresh_check_melt (struct MHD_Connection *connection, tl); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_MELT_COIN_EXPIRED_NO_ZOMBIE, + TALER_EC_EXCHANGE_MELT_COIN_EXPIRED_NO_ZOMBIE, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -243,7 +243,7 @@ refresh_check_melt (struct MHD_Connection *connection, tl); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_MELT_COIN_HISTORY_COMPUTATION_FAILED, + TALER_EC_EXCHANGE_MELT_COIN_HISTORY_COMPUTATION_FAILED, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -349,8 +349,8 @@ melt_transaction (void *cls, if (GNUNET_DB_STATUS_HARD_ERROR == qs) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_MELT_DB_FETCH_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "melt index"); return qs; } @@ -375,8 +375,8 @@ melt_transaction (void *cls, { *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_MELT_DB_STORE_SESSION_ERROR, - NULL); + TALER_EC_GENERIC_DB_STORE_FAILED, + "melt"); return GNUNET_DB_STATUS_HARD_ERROR; } return qs; @@ -425,7 +425,7 @@ handle_melt (struct MHD_Connection *connection, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_MELT_COIN_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_MELT_COIN_SIGNATURE_INVALID, NULL); } } @@ -470,7 +470,7 @@ check_for_denomination_key (struct MHD_Connection *connection, TALER_LOG_ERROR ("Lacking keys to operate\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no keys"); } @@ -517,8 +517,8 @@ check_for_denomination_key (struct MHD_Connection *connection, GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_MELT_DB_FETCH_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "coin denomination"); } /* sanity check */ GNUNET_break (0 == @@ -572,12 +572,11 @@ check_for_denomination_key (struct MHD_Connection *connection, { GNUNET_break_op (0); TEH_KS_release (key_state); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_MELT_CURRENCY_MISMATCH, - rmc->refresh_session.amount_with_fee. - currency); - + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_CURRENCY_MISMATCH, + rmc->refresh_session.amount_with_fee.currency); } /* check coin is actually properly signed */ if (GNUNET_OK != @@ -588,7 +587,7 @@ check_for_denomination_key (struct MHD_Connection *connection, TEH_KS_release (key_state); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_MELT_DENOMINATION_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_DENOMINATION_SIGNATURE_INVALID, NULL); } } @@ -602,7 +601,7 @@ check_for_denomination_key (struct MHD_Connection *connection, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_MELT_FEES_EXCEED_CONTRIBUTION, + TALER_EC_EXCHANGE_MELT_FEES_EXCEED_CONTRIBUTION, NULL); } return handle_melt (connection, diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c index 74d725653..083950f81 100644 --- a/src/exchange/taler-exchange-httpd_recoup.c +++ b/src/exchange/taler-exchange-httpd_recoup.c @@ -155,8 +155,8 @@ recoup_transaction (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_RECOUP_DB_FETCH_FAILED, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "old coin by h_blind"); } return qs; } @@ -174,8 +174,8 @@ recoup_transaction (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_RECOUP_DB_FETCH_FAILED, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "reserve by h_blind"); } return qs; } @@ -187,7 +187,7 @@ recoup_transaction (void *cls, GNUNET_h2s (&pc->h_blind)); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_RECOUP_WITHDRAW_NOT_FOUND, + TALER_EC_EXCHANGE_RECOUP_WITHDRAW_NOT_FOUND, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -205,8 +205,8 @@ recoup_transaction (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_RECOUP_DB_FETCH_FAILED, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "coin transaction list"); } return qs; } @@ -240,8 +240,8 @@ recoup_transaction (void *cls, tl); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_RECOUP_HISTORY_DB_ERROR, - NULL); + TALER_EC_GENERIC_DB_INVARIANT_FAILURE, + "coin transaction history"); return GNUNET_DB_STATUS_HARD_ERROR; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -260,7 +260,7 @@ recoup_transaction (void *cls, tl); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_RECOUP_COIN_BALANCE_NEGATIVE, + TALER_EC_EXCHANGE_RECOUP_COIN_BALANCE_NEGATIVE, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -276,7 +276,7 @@ recoup_transaction (void *cls, { /* Refuse: insufficient funds for recoup */ *mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection, - TALER_EC_RECOUP_COIN_BALANCE_ZERO, + TALER_EC_EXCHANGE_RECOUP_COIN_BALANCE_ZERO, &pc->coin->coin_pub, tl); ret = GNUNET_DB_STATUS_HARD_ERROR; @@ -327,8 +327,8 @@ recoup_transaction (void *cls, TALER_LOG_WARNING ("Failed to store recoup information in database\n"); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_RECOUP_DB_PUT_FAILED, - NULL); + TALER_EC_GENERIC_DB_STORE_FAILED, + "recoup request"); } return qs; } @@ -376,7 +376,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, TALER_LOG_ERROR ("Lacking keys to operate\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no keys"); } dki = TEH_KS_denomination_key_lookup_by_hash (key_state, @@ -406,7 +406,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, TEH_KS_release (key_state); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_RECOUP_DENOMINATION_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_DENOMINATION_SIGNATURE_INVALID, NULL); } @@ -430,7 +430,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, TEH_KS_release (key_state); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_RECOUP_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_RECOUP_SIGNATURE_INVALID, NULL); } } @@ -448,7 +448,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, TEH_KS_release (key_state); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_RECOUP_BLINDING_FAILED, + TALER_EC_EXCHANGE_RECOUP_BLINDING_FAILED, 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 ddfaeef75..6440f6dd0 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -65,7 +65,7 @@ reply_refreshes_reveal_success (struct MHD_Connection *connection, GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_JSON_ALLOCATION_FAILURE, + TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE, "json_array() call failed"); } for (unsigned int freshcoin_index = 0; @@ -84,7 +84,7 @@ reply_refreshes_reveal_success (struct MHD_Connection *connection, GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_JSON_ALLOCATION_FAILURE, + TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE, "json_pack() failed"); } if (0 != @@ -95,7 +95,7 @@ reply_refreshes_reveal_success (struct MHD_Connection *connection, GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_JSON_ALLOCATION_FAILURE, + TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE, "json_array_append_new() failed"); } } @@ -256,8 +256,8 @@ refreshes_reveal_preflight (void *cls, GNUNET_break (qs); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REVEAL_DB_FETCH_REVEAL_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "refresh reveal"); rctx->preflight_ok = GNUNET_SYSERR; return GNUNET_DB_STATUS_HARD_ERROR; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: @@ -308,7 +308,7 @@ refreshes_reveal_transaction (void *cls, { *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_REVEAL_SESSION_UNKNOWN, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_SESSION_UNKNOWN, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -320,8 +320,8 @@ refreshes_reveal_transaction (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REVEAL_DB_FETCH_SESSION_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "melt"); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -414,9 +414,10 @@ refreshes_reveal_transaction (void *cls, MHD_HTTP_CONFLICT, "{s:s, s:I, s:o}", "hint", - TALER_ErrorCode_get_hint (TALER_EC_REVEAL_COMMITMENT_VIOLATION), + TALER_ErrorCode_get_hint ( + TALER_EC_EXCHANGE_REFRESHES_REVEAL_COMMITMENT_VIOLATION), "code", - (json_int_t) TALER_EC_REVEAL_COMMITMENT_VIOLATION, + (json_int_t) TALER_EC_EXCHANGE_REFRESHES_REVEAL_COMMITMENT_VIOLATION, "rc_expected", GNUNET_JSON_from_data_auto ( &rc_expected)); @@ -451,7 +452,7 @@ refreshes_reveal_transaction (void *cls, GNUNET_break_op (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REVEAL_COST_CALCULATION_OVERFLOW, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_COST_CALCULATION_OVERFLOW, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -462,7 +463,7 @@ refreshes_reveal_transaction (void *cls, GNUNET_break_op (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_REVEAL_AMOUNT_INSUFFICIENT, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_AMOUNT_INSUFFICIENT, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -517,8 +518,8 @@ refreshes_reveal_persist (void *cls, { *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REVEAL_DB_COMMIT_ERROR, - NULL); + TALER_EC_GENERIC_DB_STORE_FAILED, + "refresh_reveal"); } return qs; } @@ -630,21 +631,21 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_REVEAL_SESSION_UNKNOWN, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_SESSION_UNKNOWN, 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, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "melt"); break; case GNUNET_DB_STATUS_SOFT_ERROR: default: GNUNET_break (0); /* should be impossible */ ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_INTERNAL_INVARIANT_FAILURE, + TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, NULL); break; } @@ -689,7 +690,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, GNUNET_break_op (0); ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_REVEAL_LINK_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_LINK_SIGNATURE_INVALID, NULL); goto cleanup; } @@ -716,7 +717,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, GNUNET_break (0); ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REVEAL_SIGNING_ERROR, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_SIGNING_ERROR, NULL); goto cleanup; } @@ -831,7 +832,7 @@ handle_refreshes_reveal_json (struct MHD_Connection *connection, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_REVEAL_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE, NULL); } @@ -841,7 +842,7 @@ handle_refreshes_reveal_json (struct MHD_Connection *connection, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISMATCH, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISMATCH, "new_denoms/coin_evs"); } if (json_array_size (new_denoms_h_json) != @@ -850,7 +851,7 @@ handle_refreshes_reveal_json (struct MHD_Connection *connection, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISMATCH, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISMATCH, "new_denoms/link_sigs"); } @@ -882,8 +883,8 @@ handle_refreshes_reveal_json (struct MHD_Connection *connection, TALER_LOG_ERROR ("Lacking keys to operate\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REVEAL_KEYS_MISSING, - "exchange lacks keys"); + TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, + NULL); } ret = resolve_refreshes_reveal_denominations (key_state, connection, @@ -945,7 +946,7 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_REVEAL_INVALID_RCH, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_INVALID_RCH, args[0]); } if (0 != strcmp (args[1], @@ -954,7 +955,7 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_OPERATION_INVALID, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_OPERATION_INVALID, args[1]); } @@ -979,7 +980,7 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID, + TALER_EC_EXCHANGE_REFRESHES_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID, NULL); } diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c index ea258d1b2..1dfd8931b 100644 --- a/src/exchange/taler-exchange-httpd_refund.c +++ b/src/exchange/taler-exchange-httpd_refund.c @@ -68,7 +68,7 @@ reply_refund_success (struct MHD_Connection *connection, { return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no online signing key"); } return TALER_MHD_reply_json_pack ( @@ -126,8 +126,8 @@ refund_transaction (void *cls, if (GNUNET_DB_STATUS_HARD_ERROR == qs) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REFUND_DATABASE_LOOKUP_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "coin transactions"); return qs; } deposit_found = false; @@ -162,7 +162,7 @@ refund_transaction (void *cls, /* money was already transferred to merchant, can no longer refund */ *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_GONE, - TALER_EC_REFUND_MERCHANT_ALREADY_PAID, + TALER_EC_EXCHANGE_REFUND_MERCHANT_ALREADY_PAID, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -230,12 +230,12 @@ refund_transaction (void *cls, *mhd_ret = TALER_MHD_reply_json_pack ( connection, MHD_HTTP_PRECONDITION_FAILED, - "{s:s, s:s, s:I, s:o}", + "{s:o, s:s, s:I, s:o}", "detail", - "conflicting refund with different amount but same refund transaction ID", + TALER_JSON_from_amount (&ref->refund_amount), "hint", TALER_ErrorCode_get_hint ( - TALER_EC_REFUND_INCONSISTENT_AMOUNT), - "code", (json_int_t) TALER_EC_REFUND_INCONSISTENT_AMOUNT, + TALER_EC_EXCHANGE_REFUND_INCONSISTENT_AMOUNT), + "code", (json_int_t) TALER_EC_EXCHANGE_REFUND_INCONSISTENT_AMOUNT, "history", TEH_RESPONSE_compile_transaction_history ( &refund->coin.coin_pub, tli)); @@ -307,7 +307,7 @@ refund_transaction (void *cls, tlx); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_REFUND_DEPOSIT_NOT_FOUND, + TALER_EC_EXCHANGE_REFUND_DEPOSIT_NOT_FOUND, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -322,7 +322,7 @@ refund_transaction (void *cls, tlx); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_REFUND_CURRENCY_MISMATCH, + TALER_EC_GENERIC_CURRENCY_MISMATCH, deposit_total.currency); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -346,9 +346,10 @@ refund_transaction (void *cls, "detail", "total amount refunded exceeds total amount deposited for this coin", "hint", - TALER_ErrorCode_get_hint (TALER_EC_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT), + TALER_ErrorCode_get_hint ( + TALER_EC_EXCHANGE_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT), "code", - (json_int_t) TALER_EC_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT, + (json_int_t) TALER_EC_EXCHANGE_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT, "history", TEH_RESPONSE_compile_transaction_history (&refund->coin.coin_pub, tlx)); @@ -369,8 +370,8 @@ refund_transaction (void *cls, TALER_LOG_WARNING ("Failed to store /refund information in database\n"); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REFUND_STORE_DB_ERROR, - NULL); + TALER_EC_GENERIC_DB_STORE_FAILED, + "refund"); return qs; } /* Success or soft failure */ @@ -415,7 +416,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, TALER_LOG_WARNING ("Invalid signature on refund request\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_REFUND_MERCHANT_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_REFUND_MERCHANT_SIGNATURE_INVALID, NULL); } } @@ -438,7 +439,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, sizeof (denom_hash)); res = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_REFUND_COIN_NOT_FOUND, + TALER_EC_EXCHANGE_REFUND_COIN_NOT_FOUND, dhs); GNUNET_free (dhs); return res; @@ -454,7 +455,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, TALER_LOG_ERROR ("Lacking keys to operate\n"); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no keys"); } /* Obtain information about the coin's denomination! */ diff --git a/src/exchange/taler-exchange-httpd_reserves_get.c b/src/exchange/taler-exchange-httpd_reserves_get.c index 2272e6d03..a5ebaabf1 100644 --- a/src/exchange/taler-exchange-httpd_reserves_get.c +++ b/src/exchange/taler-exchange-httpd_reserves_get.c @@ -50,7 +50,7 @@ reply_reserve_history_success (struct MHD_Connection *connection, if (NULL == json_history) return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_RESERVE_STATUS_DB_ERROR, + TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE, NULL); json_balance = TALER_JSON_from_amount (&balance); return TALER_MHD_reply_json_pack (connection, @@ -142,7 +142,7 @@ TEH_handler_reserves_get (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_RESERVES_INVALID_RESERVE_PUB, + TALER_EC_MERCHANT_GENERIC_RESERVE_PUB_MALFORMED, args[0]); } rsc.rh = NULL; @@ -158,7 +158,7 @@ TEH_handler_reserves_get (const struct TEH_RequestHandler *rh, if (NULL == rsc.rh) return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_RESERVE_STATUS_UNKNOWN, + TALER_EC_EXCHANGE_RESERVES_GET_STATUS_UNKNOWN, args[0]); mhd_ret = reply_reserve_history_success (connection, rsc.rh); diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index d7d118615..32b44ffca 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -445,7 +445,7 @@ TEH_RESPONSE_reply_coin_insufficient_funds ( GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_JSON_ALLOCATION_FAILURE, + TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE, "Failed to generated proof of insufficient funds"); } return TALER_MHD_reply_json_pack (connection, diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c index 7cf37b375..b5237df25 100644 --- a/src/exchange/taler-exchange-httpd_transfers_get.c +++ b/src/exchange/taler-exchange-httpd_transfers_get.c @@ -105,7 +105,7 @@ reply_transfer_details (struct MHD_Connection *connection, { return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_JSON_ALLOCATION_FAILURE, + TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE, "json_array() failed"); } @@ -144,7 +144,7 @@ reply_transfer_details (struct MHD_Connection *connection, GNUNET_CRYPTO_hash_context_abort (hash_context); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_JSON_ALLOCATION_FAILURE, + TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE, "json_array_append_new() failed"); } } @@ -166,7 +166,7 @@ reply_transfer_details (struct MHD_Connection *connection, json_decref (deposits); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no keys"); } @@ -445,8 +445,8 @@ get_transfer_deposits (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_TRANSFERS_GET_DB_FETCH_FAILED, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "wire transfer"); } return qs; } @@ -455,15 +455,15 @@ get_transfer_deposits (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_TRANSFERS_GET_DB_INCONSISTENT, - NULL); + TALER_EC_GENERIC_DB_INVARIANT_FAILURE, + "wire history malformed"); return GNUNET_DB_STATUS_HARD_ERROR; } if (GNUNET_NO == ctx->is_valid) { *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_TRANSFERS_GET_WTID_NOT_FOUND, + TALER_EC_EXCHANGE_TRANSFERS_GET_WTID_NOT_FOUND, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -484,7 +484,7 @@ get_transfer_deposits (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_TRANSFERS_GET_WIRE_FEE_NOT_FOUND, + TALER_EC_EXCHANGE_TRANSFERS_GET_WIRE_FEE_NOT_FOUND, NULL); } return qs; @@ -497,7 +497,7 @@ get_transfer_deposits (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_TRANSFERS_GET_WIRE_FEE_INCONSISTENT, + TALER_EC_EXCHANGE_TRANSFERS_GET_WIRE_FEE_INCONSISTENT, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -534,7 +534,7 @@ TEH_handler_transfers_get (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_TRANSFERS_INVALID_WTID, + TALER_EC_EXCHANGE_TRANSFERS_GET_WTID_MALFORMED, args[0]); } if (GNUNET_OK != diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index f39f08971..0b5eb7370 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -65,7 +65,7 @@ reply_withdraw_insufficient_funds ( if (NULL == json_history) return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_WITHDRAW_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS, + TALER_EC_EXCHANGE_WITHDRAW_HISTORY_ERROR_INSUFFICIENT_FUNDS, NULL); if (0 != TALER_amount_cmp (&balance, @@ -75,17 +75,17 @@ reply_withdraw_insufficient_funds ( json_decref (json_history); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_WITHDRAW_RESERVE_BALANCE_CORRUPT, - NULL); + TALER_EC_GENERIC_DB_INVARIANT_FAILURE, + "reserve balance corrupt"); } 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), + TALER_ErrorCode_get_hint (TALER_EC_EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS), "code", - (json_int_t) TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS, + (json_int_t) TALER_EC_EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS, "balance", TALER_JSON_from_amount (&balance), "history", @@ -198,8 +198,8 @@ withdraw_transaction (void *cls, if (GNUNET_DB_STATUS_HARD_ERROR == qs) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_WITHDRAW_DB_FETCH_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "withdraw details"); wc->collectable.sig = denom_sig; return qs; } @@ -233,15 +233,15 @@ withdraw_transaction (void *cls, if (GNUNET_DB_STATUS_HARD_ERROR == qs) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_WITHDRAW_DB_FETCH_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "reserves"); return qs; } if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) { *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_WITHDRAW_RESERVE_UNKNOWN, + TALER_EC_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -275,8 +275,8 @@ withdraw_transaction (void *cls, if (GNUNET_DB_STATUS_HARD_ERROR == qs) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_WITHDRAW_DB_FETCH_ERROR, - NULL); + TALER_EC_GENERIC_DB_FETCH_FAILED, + "reserve history"); return GNUNET_DB_STATUS_HARD_ERROR; } *mhd_ret = reply_withdraw_insufficient_funds (connection, @@ -300,7 +300,7 @@ withdraw_transaction (void *cls, GNUNET_break (0); *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_WITHDRAW_SIGNATURE_FAILED, + TALER_EC_EXCHANGE_WITHDRAW_SIGNATURE_FAILED, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -320,8 +320,8 @@ withdraw_transaction (void *cls, if (GNUNET_DB_STATUS_HARD_ERROR == qs) *mhd_ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_WITHDRAW_DB_STORE_ERROR, - NULL); + TALER_EC_GENERIC_DB_STORE_FAILED, + "withdraw details"); return qs; } return qs; @@ -371,7 +371,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_RESERVES_INVALID_RESERVE_PUB, + TALER_EC_MERCHANT_GENERIC_RESERVE_PUB_MALFORMED, args[0]); } @@ -391,7 +391,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, + TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, "no keys"); } { @@ -431,7 +431,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, TEH_KS_release (wc.key_state); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_WITHDRAW_AMOUNT_FEE_OVERFLOW, + TALER_EC_EXCHANGE_WITHDRAW_AMOUNT_FEE_OVERFLOW, NULL); } TALER_amount_hton (&wc.wsrd.amount_with_fee, @@ -460,7 +460,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, TEH_KS_release (wc.key_state); return TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, - TALER_EC_WITHDRAW_RESERVE_SIGNATURE_INVALID, + TALER_EC_EXCHANGE_WITHDRAW_RESERVE_SIGNATURE_INVALID, NULL); } @@ -477,7 +477,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, TEH_KS_release (wc.key_state); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_WITHDRAW_SIGNATURE_FAILED, + TALER_EC_EXCHANGE_WITHDRAW_SIGNATURE_FAILED, NULL); } #endif diff --git a/src/json/json.c b/src/json/json.c index 266857198..78867a913 100644 --- a/src/json/json.c +++ b/src/json/json.c @@ -616,7 +616,7 @@ TALER_JSON_get_error_code (const json_t *json) if (NULL == json) { GNUNET_break_op (0); - return TALER_EC_INVALID_RESPONSE; + return TALER_EC_GENERIC_INVALID_RESPONSE; } jc = json_object_get (json, "code"); /* The caller already knows that the JSON represents an error, diff --git a/src/lib/auditor_api_deposit_confirmation.c b/src/lib/auditor_api_deposit_confirmation.c index 1856a89f4..ff65036e0 100644 --- a/src/lib/auditor_api_deposit_confirmation.c +++ b/src/lib/auditor_api_deposit_confirmation.c @@ -96,7 +96,7 @@ handle_deposit_confirmation_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: hr.ec = TALER_EC_NONE; diff --git a/src/lib/auditor_api_exchanges.c b/src/lib/auditor_api_exchanges.c index a2e84f19f..78f4d90e6 100644 --- a/src/lib/auditor_api_exchanges.c +++ b/src/lib/auditor_api_exchanges.c @@ -98,7 +98,7 @@ handle_exchanges_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: ja = json_object_get (json, @@ -107,7 +107,7 @@ handle_exchanges_finished (void *cls, (! json_is_array (ja)) ) { GNUNET_break (0); - hr.ec = TALER_EC_AUDITOR_EXCHANGES_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; hr.http_status = 0; break; } @@ -116,7 +116,7 @@ handle_exchanges_finished (void *cls, if (ja_len > MAX_EXCHANGES) { GNUNET_break (0); - hr.ec = TALER_EC_AUDITOR_EXCHANGES_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; hr.http_status = 0; break; } @@ -141,7 +141,7 @@ handle_exchanges_finished (void *cls, { GNUNET_break_op (0); ok = GNUNET_NO; - hr.ec = TALER_EC_AUDITOR_EXCHANGES_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; hr.http_status = 0; break; } diff --git a/src/lib/auditor_api_handle.c b/src/lib/auditor_api_handle.c index 5a293584f..d3cecf75b 100644 --- a/src/lib/auditor_api_handle.c +++ b/src/lib/auditor_api_handle.c @@ -212,7 +212,7 @@ decode_version_json (const json_t *resp_obj, if (JSON_OBJECT != json_typeof (resp_obj)) { GNUNET_break_op (0); - return TALER_EC_JSON_INVALID; + return TALER_EC_GENERIC_JSON_INVALID; } /* check the version */ if (GNUNET_OK != @@ -221,7 +221,7 @@ decode_version_json (const json_t *resp_obj, NULL, NULL)) { GNUNET_break_op (0); - return TALER_EC_JSON_INVALID; + return TALER_EC_GENERIC_JSON_INVALID; } if (3 != sscanf (ver, "%u:%u:%u", @@ -230,7 +230,7 @@ decode_version_json (const json_t *resp_obj, &age)) { GNUNET_break_op (0); - return TALER_EC_VERSION_MALFORMED; + return TALER_EC_GENERIC_VERSION_MALFORMED; } auditor->version = GNUNET_strdup (ver); vi->version = auditor->version; @@ -307,7 +307,7 @@ version_completed_cb (void *cls, GNUNET_break_op (0); TALER_LOG_WARNING ("NULL body for a 200-OK /version\n"); hr.http_status = 0; - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; } hr.ec = decode_version_json (resp_obj, diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index 51783dbb4..7bb083efe 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -274,7 +274,7 @@ verify_deposit_signature_conflict ( ec = TALER_JSON_get_error_code (json); switch (ec) { - case TALER_EC_DEPOSIT_INSUFFICIENT_FUNDS: + case TALER_EC_EXCHANGE_DEPOSIT_INSUFFICIENT_FUNDS: if (0 > TALER_amount_add (&total, &total, @@ -294,7 +294,7 @@ verify_deposit_signature_conflict ( } /* everything OK, proof of double-spending was provided */ return GNUNET_OK; - case TALER_EC_COIN_CONFLICTING_DENOMINATION_KEY: + case TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY: if (0 != GNUNET_memcmp (&dh->dki.h_key, &h_denom_pub)) return GNUNET_OK; /* indeed, proof with different denomination key provided */ @@ -336,7 +336,7 @@ handle_deposit_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: if (GNUNET_OK != @@ -347,7 +347,7 @@ handle_deposit_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE; } else { @@ -369,7 +369,7 @@ handle_deposit_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE; } else { diff --git a/src/lib/exchange_api_deposits_get.c b/src/lib/exchange_api_deposits_get.c index 8cb9c3fff..d5b2395aa 100644 --- a/src/lib/exchange_api_deposits_get.c +++ b/src/lib/exchange_api_deposits_get.c @@ -142,7 +142,7 @@ handle_deposit_wtid_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: { @@ -163,7 +163,7 @@ handle_deposit_wtid_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_DEPOSITS_INVALID_BODY_BY_EXCHANGE; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } dwh->depconf.execution_time = GNUNET_TIME_absolute_hton ( @@ -178,7 +178,7 @@ handle_deposit_wtid_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_DEPOSITS_INVALID_SIGNATURE_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_SIGNATURE_BY_EXCHANGE; } else { @@ -207,7 +207,7 @@ handle_deposit_wtid_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_DEPOSITS_INVALID_BODY_BY_EXCHANGE; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } else diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index 75b63abcb..4d8f0d037 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -1326,7 +1326,7 @@ keys_completed_cb (void *cls, { TALER_LOG_ERROR ("Could not decode /keys response\n"); hr.http_status = 0; - hr.ec = TALER_EC_KEYS_INVALID; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; for (unsigned int i = 0; ilink_cb); diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c index 72a90dc33..b89443c84 100644 --- a/src/lib/exchange_api_melt.c +++ b/src/lib/exchange_api_melt.c @@ -282,7 +282,7 @@ verify_melt_signature_spend_conflict (struct TALER_EXCHANGE_MeltHandle *mh, ec = TALER_JSON_get_error_code (json); switch (ec) { - case TALER_EC_MELT_INSUFFICIENT_FUNDS: + case TALER_EC_EXCHANGE_MELT_INSUFFICIENT_FUNDS: /* check if melt operation was really too expensive given history */ if (0 > TALER_amount_add (&total, @@ -304,7 +304,7 @@ verify_melt_signature_spend_conflict (struct TALER_EXCHANGE_MeltHandle *mh, /* everything OK, valid proof of double-spending was provided */ return GNUNET_OK; - case TALER_EC_COIN_CONFLICTING_DENOMINATION_KEY: + case TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY: if (0 != GNUNET_memcmp (&mh->dki.h_key, &h_denom_pub)) return GNUNET_OK; /* indeed, proof with different denomination key provided */ @@ -345,7 +345,7 @@ handle_melt_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: if (GNUNET_OK != @@ -356,7 +356,7 @@ handle_melt_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_MELT_INVALID_SIGNATURE_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_MELT_INVALID_SIGNATURE_BY_EXCHANGE; } if (NULL != mh->melt_cb) { @@ -379,7 +379,7 @@ handle_melt_finished (void *cls, hr.ec = TALER_JSON_get_error_code (j); switch (hr.ec) { - case TALER_EC_MELT_INSUFFICIENT_FUNDS: + case TALER_EC_EXCHANGE_MELT_INSUFFICIENT_FUNDS: /* Double spending; check signatures on transaction history */ if (GNUNET_OK != verify_melt_signature_spend_conflict (mh, @@ -387,25 +387,25 @@ handle_melt_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_MELT_INVALID_SIGNATURE_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_MELT_INVALID_SIGNATURE_BY_EXCHANGE; hr.hint = TALER_JSON_get_error_hint (j); } break; - case TALER_EC_COIN_CONFLICTING_DENOMINATION_KEY: + case TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY: if (GNUNET_OK != verify_melt_signature_denom_conflict (mh, j)) { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_MELT_INVALID_SIGNATURE_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_MELT_INVALID_SIGNATURE_BY_EXCHANGE; hr.hint = TALER_JSON_get_error_hint (j); } break; default: GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_MELT_INVALID_SIGNATURE_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_MELT_INVALID_SIGNATURE_BY_EXCHANGE; hr.hint = TALER_JSON_get_error_hint (j); break; } diff --git a/src/lib/exchange_api_recoup.c b/src/lib/exchange_api_recoup.c index d8c59827c..72d946343 100644 --- a/src/lib/exchange_api_recoup.c +++ b/src/lib/exchange_api_recoup.c @@ -162,7 +162,7 @@ handle_recoup_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: if (GNUNET_OK != @@ -170,7 +170,7 @@ handle_recoup_finished (void *cls, j)) { GNUNET_break_op (0); - hr.ec = TALER_EC_RECOUP_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; hr.http_status = 0; break; } @@ -204,7 +204,7 @@ handle_recoup_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_RECOUP_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; } else { @@ -214,7 +214,7 @@ handle_recoup_finished (void *cls, ec = TALER_JSON_get_error_code (j); switch (ec) { - case TALER_EC_RECOUP_COIN_BALANCE_ZERO: + case TALER_EC_EXCHANGE_RECOUP_COIN_BALANCE_ZERO: if (0 > TALER_amount_cmp (&total, &dki->value)) { @@ -224,20 +224,21 @@ handle_recoup_finished (void *cls, exchange is here. We should look at the key structure of ph->exchange, and find the smallest _currently withdrawable_ denomination and check - if the value remaining would suffice... */GNUNET_break_op (0); + if the value remaining would suffice... */// + GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_RECOUP_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } break; - case TALER_EC_COIN_CONFLICTING_DENOMINATION_KEY: + case TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY: if (0 == GNUNET_memcmp (&ph->pk.h_key, &h_denom_pub)) { /* invalid proof provided */ GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_RECOUP_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } /* valid error from exchange */ @@ -245,7 +246,7 @@ handle_recoup_finished (void *cls, default: GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_RECOUP_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } ph->cb (ph->cb_cls, diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c index 6ffbb9a34..642ed6c9a 100644 --- a/src/lib/exchange_api_refreshes_reveal.c +++ b/src/lib/exchange_api_refreshes_reveal.c @@ -211,7 +211,7 @@ handle_refresh_reveal_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: { @@ -225,7 +225,7 @@ handle_refresh_reveal_finished (void *cls, if (GNUNET_OK != ret) { hr.http_status = 0; - hr.ec = TALER_EC_REVEAL_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; } else { diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c index 55f71757c..870f3afdc 100644 --- a/src/lib/exchange_api_refund.c +++ b/src/lib/exchange_api_refund.c @@ -533,7 +533,7 @@ handle_refund_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: if (GNUNET_OK != @@ -544,7 +544,7 @@ handle_refund_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_REFUND_INVALID_SIGNATURE_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_REFUND_INVALID_SIGNATURE_BY_EXCHANGE; } else { @@ -581,7 +581,7 @@ handle_refund_finished (void *cls, { GNUNET_break (0); hr.http_status = 0; - hr.ec = TALER_EC_REFUND_INVALID_FAILURE_PROOF_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_REFUND_INVALID_FAILURE_PROOF_BY_EXCHANGE; hr.hint = "conflict information provided by exchange is invalid"; break; } @@ -601,7 +601,7 @@ handle_refund_finished (void *cls, { GNUNET_break (0); hr.http_status = 0; - hr.ec = TALER_EC_REFUND_INVALID_FAILURE_PROOF_BY_EXCHANGE; + hr.ec = TALER_EC_EXCHANGE_REFUND_INVALID_FAILURE_PROOF_BY_EXCHANGE; hr.hint = "failed precondition proof returned by exchange is invalid"; break; } diff --git a/src/lib/exchange_api_reserves_get.c b/src/lib/exchange_api_reserves_get.c index 236cc0c73..3332a165e 100644 --- a/src/lib/exchange_api_reserves_get.c +++ b/src/lib/exchange_api_reserves_get.c @@ -182,7 +182,7 @@ handle_reserves_get_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: if (GNUNET_OK != @@ -190,7 +190,7 @@ handle_reserves_get_finished (void *cls, j)) { hr.http_status = 0; - hr.ec = TALER_EC_RESERVE_STATUS_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; } break; case MHD_HTTP_BAD_REQUEST: diff --git a/src/lib/exchange_api_transfers_get.c b/src/lib/exchange_api_transfers_get.c index c9b0640a7..e5bb17a83 100644 --- a/src/lib/exchange_api_transfers_get.c +++ b/src/lib/exchange_api_transfers_get.c @@ -276,7 +276,7 @@ handle_transfers_get_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: if (GNUNET_OK == @@ -284,7 +284,7 @@ handle_transfers_get_finished (void *cls, j)) return; GNUNET_break_op (0); - hr.ec = TALER_EC_TRANSFERS_GET_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; hr.http_status = 0; break; case MHD_HTTP_BAD_REQUEST: diff --git a/src/lib/exchange_api_wire.c b/src/lib/exchange_api_wire.c index fec2b990e..f70c00864 100644 --- a/src/lib/exchange_api_wire.c +++ b/src/lib/exchange_api_wire.c @@ -219,7 +219,7 @@ handle_wire_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: { @@ -242,7 +242,7 @@ handle_wire_finished (void *cls, /* bogus reply */ GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_SERVER_JSON_INVALID; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } if (0 == (num_accounts = json_array_size (accounts))) @@ -251,7 +251,7 @@ handle_wire_finished (void *cls, GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); hr.http_status = 0; - hr.ec = TALER_EC_SERVER_JSON_INVALID; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } if (NULL == (fm = parse_fees (fees))) @@ -260,7 +260,7 @@ handle_wire_finished (void *cls, GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); hr.http_status = 0; - hr.ec = TALER_EC_SERVER_JSON_INVALID; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } @@ -289,7 +289,7 @@ handle_wire_finished (void *cls, /* bogus reply */ GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_SERVER_SIGNATURE_INVALID; + hr.ec = TALER_EC_EXCHANGE_WIRE_SIGNATURE_INVALID; break; } if (GNUNET_OK != @@ -300,7 +300,7 @@ handle_wire_finished (void *cls, /* bogus reply */ GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_SERVER_JSON_INVALID; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } if (NULL == (method = TALER_payto_get_method (wa->payto_uri))) @@ -308,7 +308,7 @@ handle_wire_finished (void *cls, /* bogus reply */ GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_SERVER_JSON_INVALID; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } if (NULL == (wa->fees = lookup_fee (fm, @@ -317,7 +317,7 @@ handle_wire_finished (void *cls, /* bogus reply */ GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_SERVER_JSON_INVALID; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; GNUNET_free (method); break; } diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c index 88b0b1f63..b96adacd4 100644 --- a/src/lib/exchange_api_withdraw.c +++ b/src/lib/exchange_api_withdraw.c @@ -113,7 +113,7 @@ handle_reserve_withdraw_finished ( struct TALER_EXCHANGE_HttpResponse hrx = { .reply = hr->reply, .http_status = 0, - .ec = TALER_EC_WITHDRAW_UNBLIND_FAILURE + .ec = TALER_EC_EXCHANGE_WITHDRAW_UNBLIND_FAILURE }; wh->cb (wh->cb_cls, diff --git a/src/lib/exchange_api_withdraw2.c b/src/lib/exchange_api_withdraw2.c index c51138d90..2b6b1a8fc 100644 --- a/src/lib/exchange_api_withdraw2.c +++ b/src/lib/exchange_api_withdraw2.c @@ -254,7 +254,7 @@ handle_reserve_withdraw_finished (void *cls, switch (response_code) { case 0: - hr.ec = TALER_EC_INVALID_RESPONSE; + hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; case MHD_HTTP_OK: if (GNUNET_OK != @@ -263,7 +263,7 @@ handle_reserve_withdraw_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_WITHDRAW_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } GNUNET_assert (NULL == wh->cb); @@ -284,7 +284,7 @@ handle_reserve_withdraw_finished (void *cls, { GNUNET_break_op (0); hr.http_status = 0; - hr.ec = TALER_EC_WITHDRAW_REPLY_MALFORMED; + hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; } else { diff --git a/src/mhd/mhd_parsing.c b/src/mhd/mhd_parsing.c index a9f627491..d522f20f9 100644 --- a/src/mhd/mhd_parsing.c +++ b/src/mhd/mhd_parsing.c @@ -79,7 +79,7 @@ TALER_MHD_parse_post_json (struct MHD_Connection *connection, TALER_MHD_reply_with_error ( connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_PARSER_OUT_OF_MEMORY, + TALER_EC_GENERIC_PARSER_OUT_OF_MEMORY, NULL)) ? GNUNET_SYSERR : GNUNET_NO; case GNUNET_JSON_PR_CONTINUE: @@ -95,7 +95,7 @@ TALER_MHD_parse_post_json (struct MHD_Connection *connection, return (MHD_YES == TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_JSON_INVALID, + TALER_EC_GENERIC_JSON_INVALID, NULL)) ? GNUNET_NO : GNUNET_SYSERR; case GNUNET_JSON_PR_SUCCESS: @@ -153,7 +153,7 @@ TALER_MHD_parse_request_arg_data (struct MHD_Connection *connection, return (MHD_NO == TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_PARAMETER_MISSING, + TALER_EC_GENERIC_PARAMETER_MISSING, param_name)) ? GNUNET_SYSERR : GNUNET_NO; } @@ -165,7 +165,7 @@ TALER_MHD_parse_request_arg_data (struct MHD_Connection *connection, return (MHD_NO == TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, - TALER_EC_PARAMETER_MALFORMED, + TALER_EC_GENERIC_PARAMETER_MALFORMED, param_name)) ? GNUNET_SYSERR : GNUNET_NO; return GNUNET_OK; @@ -208,9 +208,8 @@ TALER_MHD_parse_json_data (struct MHD_Connection *connection, connection, MHD_HTTP_BAD_REQUEST, "{s:s, s:I, s:s, s:I}", - "hint", TALER_ErrorCode_get_hint ( - TALER_EC_JSON_INVALID_WITH_DETAILS), - "code", (json_int_t) TALER_EC_JSON_INVALID_WITH_DETAILS, + "hint", TALER_ErrorCode_get_hint (TALER_EC_GENERIC_JSON_INVALID), + "code", (json_int_t) TALER_EC_GENERIC_JSON_INVALID, "field", error_json_name, "line", (json_int_t) error_line)) ? GNUNET_NO : GNUNET_SYSERR; @@ -261,8 +260,8 @@ TALER_MHD_parse_internal_json_data (struct MHD_Connection *connection, MHD_HTTP_INTERNAL_SERVER_ERROR, "{s:s, s:I, s:s, s:I}", "hint", TALER_ErrorCode_get_hint ( - TALER_EC_INTERNAL_INVARIANT_FAILURE), - "code", (json_int_t) TALER_EC_INTERNAL_INVARIANT_FAILURE, + TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE), + "code", (json_int_t) TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, "field", error_json_name, "line", (json_int_t) error_line)) ? GNUNET_NO : GNUNET_SYSERR; @@ -315,9 +314,8 @@ TALER_MHD_parse_json_array (struct MHD_Connection *connection, connection, MHD_HTTP_BAD_REQUEST, "{s:s, s:I, s:s, s:I}", - "hint", TALER_ErrorCode_get_hint ( - TALER_EC_JSON_INVALID_WITH_DETAILS), - "code", (json_int_t) TALER_EC_JSON_INVALID_WITH_DETAILS, + "hint", TALER_ErrorCode_get_hint (TALER_EC_GENERIC_JSON_INVALID), + "code", (json_int_t) TALER_EC_GENERIC_JSON_INVALID, "detail", "expected array", "dimension", dim)) ? GNUNET_NO : GNUNET_SYSERR; @@ -337,9 +335,8 @@ TALER_MHD_parse_json_array (struct MHD_Connection *connection, MHD_HTTP_BAD_REQUEST, "{s:s, s:s, s:I, s:I}", "detail", error_json_name, - "hint", TALER_ErrorCode_get_hint ( - TALER_EC_JSON_INVALID_WITH_DETAILS), - "code", (json_int_t) TALER_EC_JSON_INVALID_WITH_DETAILS, + "hint", TALER_ErrorCode_get_hint (TALER_EC_GENERIC_JSON_INVALID), + "code", (json_int_t) TALER_EC_GENERIC_JSON_INVALID, "line", (json_int_t) error_line)) ? GNUNET_NO : GNUNET_SYSERR; return ret; diff --git a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c index 2d1ff9c24..f40d78c88 100644 --- a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c +++ b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c @@ -153,7 +153,7 @@ deposit_confirmation_cb (void *cls, { dcs->do_retry--; if ( (0 == hr->http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) || + (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -161,7 +161,7 @@ deposit_confirmation_cb (void *cls, hr->http_status, (int) hr->ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) + if (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) dcs->backoff = GNUNET_TIME_UNIT_ZERO; else dcs->backoff = GNUNET_TIME_randomized_backoff (dcs->backoff, diff --git a/src/testing/testing_api_cmd_auditor_exchanges.c b/src/testing/testing_api_cmd_auditor_exchanges.c index 3c77f7d82..1e412b2d1 100644 --- a/src/testing/testing_api_cmd_auditor_exchanges.c +++ b/src/testing/testing_api_cmd_auditor_exchanges.c @@ -146,7 +146,7 @@ exchanges_cb (void *cls, { es->do_retry--; if ( (0 == hr->http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) || + (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -154,7 +154,7 @@ exchanges_cb (void *cls, hr->http_status, (int) hr->ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) + if (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) es->backoff = GNUNET_TIME_UNIT_ZERO; else es->backoff = GNUNET_TIME_randomized_backoff (es->backoff, diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c index 0ea5a058c..df1eb0a32 100644 --- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c +++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c @@ -246,7 +246,7 @@ confirmation_cb (void *cls, { fts->do_retry--; if ( (0 == http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || + (TALER_EC_GENERIC_DB_SOFT_FAILURE == ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log ( @@ -255,7 +255,7 @@ confirmation_cb (void *cls, http_status, (int) ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + if (TALER_EC_GENERIC_DB_SOFT_FAILURE == ec) fts->backoff = GNUNET_TIME_UNIT_ZERO; else fts->backoff = GNUNET_TIME_randomized_backoff (fts->backoff, diff --git a/src/testing/testing_api_cmd_bank_transfer.c b/src/testing/testing_api_cmd_bank_transfer.c index 36d5e8919..565d6e460 100644 --- a/src/testing/testing_api_cmd_bank_transfer.c +++ b/src/testing/testing_api_cmd_bank_transfer.c @@ -187,7 +187,7 @@ confirmation_cb (void *cls, { fts->do_retry--; if ( (0 == http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || + (TALER_EC_GENERIC_DB_SOFT_FAILURE == ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -195,7 +195,7 @@ confirmation_cb (void *cls, http_status, (int) ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + if (TALER_EC_GENERIC_DB_SOFT_FAILURE == ec) fts->backoff = GNUNET_TIME_UNIT_ZERO; else fts->backoff = EXCHANGE_LIB_BACKOFF (fts->backoff); diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c index 76f0722de..0eb09bd39 100644 --- a/src/testing/testing_api_cmd_deposit.c +++ b/src/testing/testing_api_cmd_deposit.c @@ -230,7 +230,7 @@ deposit_cb (void *cls, { ds->do_retry--; if ( (0 == hr->http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) || + (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -238,7 +238,7 @@ deposit_cb (void *cls, hr->http_status, (int) hr->ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) + if (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) ds->backoff = GNUNET_TIME_UNIT_ZERO; else ds->backoff = GNUNET_TIME_randomized_backoff (ds->backoff, diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c index 9a13c1354..fcf8540c0 100644 --- a/src/testing/testing_api_cmd_refresh.c +++ b/src/testing/testing_api_cmd_refresh.c @@ -355,7 +355,7 @@ reveal_cb (void *cls, { rrs->do_retry--; if ( (0 == hr->http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) || + (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -363,7 +363,7 @@ reveal_cb (void *cls, hr->http_status, (int) hr->ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) + if (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) rrs->backoff = GNUNET_TIME_UNIT_ZERO; else rrs->backoff = GNUNET_TIME_randomized_backoff (rrs->backoff, @@ -592,7 +592,7 @@ link_cb (void *cls, { rls->do_retry--; if ( (0 == hr->http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) || + (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -600,7 +600,7 @@ link_cb (void *cls, hr->http_status, (int) hr->ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) + if (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) rls->backoff = GNUNET_TIME_UNIT_ZERO; else rls->backoff = GNUNET_TIME_randomized_backoff (rls->backoff, @@ -895,7 +895,7 @@ melt_cb (void *cls, { rms->do_retry--; if ( (0 == hr->http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) || + (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -903,7 +903,7 @@ melt_cb (void *cls, hr->http_status, (int) hr->ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) + if (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) rms->backoff = GNUNET_TIME_UNIT_ZERO; else rms->backoff = GNUNET_TIME_randomized_backoff (rms->backoff, diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c index 5b2ad26e4..df33ef2eb 100644 --- a/src/testing/testing_api_cmd_withdraw.c +++ b/src/testing/testing_api_cmd_withdraw.c @@ -194,12 +194,12 @@ reserve_withdraw_cb (void *cls, { if (0 != ws->do_retry) { - if (TALER_EC_WITHDRAW_RESERVE_UNKNOWN != hr->ec) + if (TALER_EC_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN != hr->ec) ws->do_retry--; /* we don't count reserve unknown as failures here */ if ( (0 == hr->http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) || - (TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS == hr->ec) || - (TALER_EC_WITHDRAW_RESERVE_UNKNOWN == hr->ec) || + (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) || + (TALER_EC_EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS == hr->ec) || + (TALER_EC_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN == hr->ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -207,9 +207,9 @@ reserve_withdraw_cb (void *cls, hr->http_status, (int) hr->ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) + if (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) ws->backoff = GNUNET_TIME_UNIT_ZERO; - else if (TALER_EC_WITHDRAW_RESERVE_UNKNOWN != hr->ec) + else if (TALER_EC_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN != hr->ec) ws->backoff = EXCHANGE_LIB_BACKOFF (ws->backoff); else ws->backoff = GNUNET_TIME_relative_max (UNKNOWN_MIN_BACKOFF, -- cgit v1.2.3