gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] branch master updated: handle error code r


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: handle error code returned by TALER_amount_subtract in new error case TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE
Date: Tue, 09 May 2017 13:28:12 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new e6d09d2  handle error code returned by TALER_amount_subtract in new 
error case TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE
e6d09d2 is described below

commit e6d09d25681798a01cc6a61877a0ec4a0f2dca63
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue May 9 13:33:26 2017 +0200

    handle error code returned by TALER_amount_subtract in new error case 
TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE
---
 src/exchange/taler-exchange-httpd_db.c | 16 +++++++++++++---
 src/include/taler_error_codes.h        |  7 +++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_db.c 
b/src/exchange/taler-exchange-httpd_db.c
index 0634e34..f53600c 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -2402,9 +2402,19 @@ TEH_DB_execute_payback (struct MHD_Connection 
*connection,
     return TEH_RESPONSE_reply_internal_db_error (connection,
                                                 
TALER_EC_PAYBACK_HISTORY_DB_ERROR);
   }
-  TALER_amount_subtract (&amount,
-                         value,
-                         &spent);
+  if (GNUNET_SYSERR ==
+      TALER_amount_subtract (&amount,
+                             value,
+                             &spent))
+  {
+    GNUNET_break (0);
+    TEH_plugin->rollback (TEH_plugin->cls,
+                          session);
+    TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
+                                            tl);
+    return TEH_RESPONSE_reply_internal_db_error (connection,
+                                                
TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE);
+  }
   if ( (0 == amount.fraction) &&
        (0 == amount.value) )
   {
diff --git a/src/include/taler_error_codes.h b/src/include/taler_error_codes.h
index 84240c2..bfca715 100644
--- a/src/include/taler_error_codes.h
+++ b/src/include/taler_error_codes.h
@@ -896,6 +896,13 @@ enum TALER_ErrorCode
    */
   TALER_EC_PAYBACK_BLINDING_FAILED = 1858,
 
+  /**
+   * The coin's remaining balance is zero.  The request is denied.
+   * This response is provided with an HTTP status code of
+   * MHD_HTTP_INTERNAL_SERVER_ERROR
+   */
+  TALER_EC_PAYBACK_COIN_BALANCE_NEGATIVE = 1857,
+
 
 
   /* *********** Merchant backend error codes ********* */

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]