From 6d798cecba4902623ca2769b30f6b1a0f554d83e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 14 Mar 2017 15:36:19 +0100 Subject: fix logging of BEGIN error --- src/exchangedb/plugin_exchangedb_postgres.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index febbf0c6c..e14e4aa62 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1426,14 +1426,16 @@ postgres_start (void *cls, struct TALER_EXCHANGEDB_Session *session) { PGresult *result; + ExecStatusType ex; result = PQexec (session->conn, "START TRANSACTION ISOLATION LEVEL SERIALIZABLE"); if (PGRES_COMMAND_OK != - PQresultStatus (result)) + (ex = PQresultStatus (result))) { - TALER_LOG_ERROR ("Failed to start transaction: %s\n", - PQresultErrorMessage (result)); + TALER_LOG_ERROR ("Failed to start transaction (%s): %s\n", + PQresStatus (ex), + PQerrorMessage (session->conn)); GNUNET_break (0); PQclear (result); return GNUNET_SYSERR; @@ -1918,7 +1920,11 @@ postgres_reserves_in_insert (void *cls, } if (GNUNET_OK != postgres_commit (cls, session)) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to commit transaction adding amount to reserve\n"); return GNUNET_SYSERR; + } return GNUNET_OK; rollback: @@ -2173,7 +2179,7 @@ postgres_get_reserve_history (void *cls, } rh_tail->type = TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE; rh_tail->details.bank = bt; - } + } /* end of 'while (0 < rows)' */ PQclear (result); } { @@ -2232,7 +2238,7 @@ postgres_get_reserve_history (void *cls, rh_tail = rh_tail->next; rh_tail->type = TALER_EXCHANGEDB_RO_WITHDRAW_COIN; rh_tail->details.withdraw = cbc; - } + } /* end of 'while (0 < rows)' */ ret = GNUNET_OK; PQclear (result); } -- cgit v1.2.3