summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-11-07 18:51:14 +0100
committerChristian Grothoff <christian@grothoff.org>2020-11-07 18:51:54 +0100
commit8d312562bf04eeb2afac53a2f24624f8e48529bd (patch)
treeff8ee7336406c4f8805ed9cee320acd105e77004 /src/exchange
parentdde5d38c4f895b53f4bd3423487573fc3e884351 (diff)
downloadexchange-8d312562bf04eeb2afac53a2f24624f8e48529bd.tar.gz
exchange-8d312562bf04eeb2afac53a2f24624f8e48529bd.tar.bz2
exchange-8d312562bf04eeb2afac53a2f24624f8e48529bd.zip
adjust ECs
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd.c12
-rw-r--r--src/exchange/taler-exchange-httpd_db.c14
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c28
-rw-r--r--src/exchange/taler-exchange-httpd_deposits_get.c20
-rw-r--r--src/exchange/taler-exchange-httpd_keystate.c52
-rw-r--r--src/exchange/taler-exchange-httpd_link.c8
-rw-r--r--src/exchange/taler-exchange-httpd_melt.c47
-rw-r--r--src/exchange/taler-exchange-httpd_recoup.c34
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c57
-rw-r--r--src/exchange/taler-exchange-httpd_refund.c35
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_get.c6
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c2
-rw-r--r--src/exchange/taler-exchange-httpd_transfers_get.c22
-rw-r--r--src/exchange/taler-exchange-httpd_withdraw.c40
14 files changed, 175 insertions, 202 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index aa477eb2..1faea14f 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 505cf3d9..14a5b5d5 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 25c3d80c..bd38c625 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 983177aa..5b75bdcf 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 e963928d..9491234e 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 3611db50..1ad5eff0 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 87238954..8b5914e2 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 74d72565..083950f8 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 ddfaeef7..6440f6dd 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 ea258d1b..1dfd8931 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 2272e6d0..a5ebaabf 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 d7d11861..32b44ffc 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 7cf37b37..b5237df2 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 f39f0897..0b5eb737 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