[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: improve error handling in lookup
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: improve error handling in lookup_products |
Date: |
Wed, 21 Jul 2021 15:48:23 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new ba2d435e improve error handling in lookup_products
ba2d435e is described below
commit ba2d435ec00465d7235cbe26b958e22be70a87c5
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Jul 21 15:48:11 2021 +0200
improve error handling in lookup_products
---
src/backend/taler-merchant-httpd_private-get-products.c | 2 +-
src/backenddb/plugin_merchantdb_postgres.c | 15 +++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-get-products.c
b/src/backend/taler-merchant-httpd_private-get-products.c
index 9d8b40f8..fb9b2192 100644
--- a/src/backend/taler-merchant-httpd_private-get-products.c
+++ b/src/backend/taler-merchant-httpd_private-get-products.c
@@ -45,7 +45,7 @@ add_product (void *cls,
/**
- * Handle a GET "/products" request.
+ * Handle a GET "/private/products" request.
*
* @param rh context of the handler
* @param connection the MHD connection to handle
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index 54a7241b..6d272d05 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -895,9 +895,9 @@ struct LookupProductsContext
void *cb_cls;
/**
- * Internal result.
+ * Did database result extraction fail?
*/
- enum GNUNET_DB_QueryStatus qs;
+ bool extract_failed;
};
@@ -931,7 +931,7 @@ lookup_products_cb (void *cls,
i))
{
GNUNET_break (0);
- plc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ plc->extract_failed = true;
return;
}
plc->cb (plc->cb_cls,
@@ -959,7 +959,9 @@ postgres_lookup_products (void *cls,
struct PostgresClosure *pg = cls;
struct LookupProductsContext plc = {
.cb = cb,
- .cb_cls = cb_cls
+ .cb_cls = cb_cls,
+ /* Can be overwritten by the lookup_products_cb */
+ .extract_failed = false,
};
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
@@ -972,8 +974,9 @@ postgres_lookup_products (void *cls,
params,
&lookup_products_cb,
&plc);
- if (0 != plc.qs)
- return plc.qs;
+ /* If there was an error inside lookup_products_cb, return a hard error. */
+ if (plc.extract_failed)
+ return GNUNET_DB_STATUS_HARD_ERROR;
return qs;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: improve error handling in lookup_products,
gnunet <=