aboutsummaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_db.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-11-29 10:52:45 +0100
committerChristian Grothoff <christian@grothoff.org>2019-11-29 10:52:45 +0100
commit636488c2797b498c8861bc6864539a63323b3608 (patch)
tree11b0f04aa31c40a0736babf5ee0a4d0d29682a32 /src/exchange/taler-exchange-httpd_db.c
parent970e3fd4cb4a3f76d1bcf56e4cec668bcb828078 (diff)
parent785f5fb7dd5f8e4aa0258e3e72f519c77942cb7d (diff)
merge error codes
Diffstat (limited to 'src/exchange/taler-exchange-httpd_db.c')
-rw-r--r--src/exchange/taler-exchange-httpd_db.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c
index 37bd2379..19781f97 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -23,6 +23,7 @@
#include <jansson.h>
#include <gnunet/gnunet_json_lib.h>
#include "taler_json_lib.h"
+#include "taler_mhd_lib.h"
#include "taler-exchange-httpd_responses.h"
#include "taler-exchange-httpd_keystate.h"
@@ -62,8 +63,10 @@ TEH_DB_know_coin_transaction (void *cls,
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
*mhd_ret
- = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_DB_COIN_HISTORY_STORE_ERROR);
+ = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_DB_COIN_HISTORY_STORE_ERROR,
+ "could not persist coin data");
return GNUNET_DB_STATUS_HARD_ERROR;
}
return qs;
@@ -99,8 +102,10 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
{
GNUNET_break (0);
if (NULL != mhd_ret)
- *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_DB_SETUP_FAILED);
+ *mhd_ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_DB_SETUP_FAILED,
+ "could not establish database session");
return GNUNET_SYSERR;
}
TEH_plugin->preflight (TEH_plugin->cls,
@@ -117,8 +122,10 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
{
GNUNET_break (0);
if (NULL != mhd_ret)
- *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_DB_START_FAILED);
+ *mhd_ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_DB_START_FAILED,
+ "could not begin transaction");
return GNUNET_SYSERR;
}
qs = cb (cb_cls,
@@ -136,8 +143,10 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
if (NULL != mhd_ret)
- *mhd_ret = TEH_RESPONSE_reply_commit_error (connection,
- TALER_EC_DB_COMMIT_FAILED_HARD);
+ *mhd_ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_DB_COMMIT_FAILED_HARD,
+ "could not commit database transaction");
return GNUNET_SYSERR;
}
/* make sure callback did not violate invariants! */
@@ -150,8 +159,10 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
name,
MAX_TRANSACTION_COMMIT_RETRIES);
if (NULL != mhd_ret)
- *mhd_ret = TEH_RESPONSE_reply_commit_error (connection,
- TALER_EC_DB_COMMIT_FAILED_ON_RETRY);
+ *mhd_ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_DB_COMMIT_FAILED_ON_RETRY,
+ "repatedly failed to serialize database transaction");
return GNUNET_SYSERR;
}