gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 86/152: fix error reporting/handling


From: gnunet
Subject: [taler-exchange] 86/152: fix error reporting/handling
Date: Sun, 05 Jul 2020 20:47:22 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

commit b145c1728b4dfb4f45cfcb7adb86605002e6ad5d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jul 5 16:32:15 2020 +0200

    fix error reporting/handling
---
 src/exchange-tools/taler-exchange-keyup.c   | 12 ++++++------
 src/exchange/taler-exchange-httpd.c         | 14 ++++++++++----
 src/exchange/taler-exchange-httpd_wire.c    |  4 ++++
 src/exchangedb/plugin_exchangedb_postgres.c | 12 +++++++++++-
 4 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/src/exchange-tools/taler-exchange-keyup.c 
b/src/exchange-tools/taler-exchange-keyup.c
index 0f5f66a8..0ea661d4 100644
--- a/src/exchange-tools/taler-exchange-keyup.c
+++ b/src/exchange-tools/taler-exchange-keyup.c
@@ -1016,9 +1016,9 @@ create_wire_fee_for_method (void *cls,
                            af->wire_fee.currency)) )
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Invalid or missing amount in `%s' under `%s'\n",
-                  wiremethod,
-                  opt);
+                  "Invalid or missing amount for option `%s' in section 
`%s'\n",
+                  opt,
+                  section);
       *ret = GNUNET_SYSERR;
       GNUNET_free (opt);
       break;
@@ -1038,9 +1038,9 @@ create_wire_fee_for_method (void *cls,
                            af->closing_fee.currency)) )
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Invalid or missing amount in `%s' under `%s'\n",
-                  wiremethod,
-                  opt);
+                  "Invalid or missing amount for option `%s' in section 
`%s'\n",
+                  opt,
+                  section);
       *ret = GNUNET_SYSERR;
       GNUNET_free (opt);
       break;
diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index 00932c0f..df01b01b 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -827,8 +827,8 @@ exchange_serve_process_config (void)
                                                     &TEH_master_public_key.
                                                     eddsa_pub))
     {
-      fprintf (stderr,
-               "Invalid master public key given in exchange configuration.");
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Invalid master public key given in exchange 
configuration.");
       GNUNET_free (master_public_key_str);
       return GNUNET_SYSERR;
     }
@@ -840,14 +840,18 @@ exchange_serve_process_config (void)
 
   if (GNUNET_OK !=
       TEH_WIRE_init (TEH_cfg))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to setup wire subsystem\n");
     return GNUNET_SYSERR;
+  }
 
 
   if (NULL ==
       (TEH_plugin = TALER_EXCHANGEDB_plugin_load (TEH_cfg)))
   {
-    fprintf (stderr,
-             "Failed to initialize DB subsystem\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to initialize DB subsystem\n");
     TEH_WIRE_done ();
     return GNUNET_SYSERR;
   }
@@ -859,6 +863,8 @@ exchange_serve_process_config (void)
                               &serve_unixpath,
                               &unixpath_mode))
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to setup HTTPd subsystem\n");
     TEH_WIRE_done ();
     return GNUNET_SYSERR;
   }
diff --git a/src/exchange/taler-exchange-httpd_wire.c 
b/src/exchange/taler-exchange-httpd_wire.c
index 38bbad4a..471fa4fa 100644
--- a/src/exchange/taler-exchange-httpd_wire.c
+++ b/src/exchange/taler-exchange-httpd_wire.c
@@ -341,6 +341,8 @@ TEH_WIRE_init (const struct GNUNET_CONFIGURATION_Handle 
*cfg)
                                     &ret);
     if (GNUNET_OK != ret)
     {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Error setting up bank accounts\n");
       TEH_WIRE_done ();
       return GNUNET_SYSERR;
     }
@@ -349,6 +351,8 @@ TEH_WIRE_init (const struct GNUNET_CONFIGURATION_Handle 
*cfg)
        (0 == json_object_size (wire_fee_object)) )
   {
     TEH_WIRE_done ();
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "No bank accounts configured\n");
     return GNUNET_SYSERR;
   }
   wire_methods = json_pack ("{s:O, s:O, s:o}",
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 93577feb..641cbbef 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1812,8 +1812,12 @@ postgres_iterate_denomination_info (void *cls,
     .cb_cls = cb_cls,
     .pg = pc
   };
+  struct TALER_EXCHANGEDB_Session *session;
 
-  return GNUNET_PQ_eval_prepared_multi_select (postgres_get_session (pc)->conn,
+  session = postgres_get_session (pc);
+  if (NULL == session)
+    return GNUNET_DB_STATUS_HARD_ERROR;
+  return GNUNET_PQ_eval_prepared_multi_select (session->conn,
                                                "denomination_iterate",
                                                params,
                                                &domination_cb_helper,
@@ -3068,6 +3072,8 @@ postgres_get_known_coin (void *cls,
   coin_info->coin_pub = *coin_pub;
   if (NULL == session)
     session = postgres_get_session (pc);
+  if (NULL == session)
+    return GNUNET_DB_STATUS_HARD_ERROR;
   return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
                                                    "get_known_coin",
                                                    params,
@@ -3107,6 +3113,8 @@ postgres_get_coin_denomination (
               TALER_B2S (coin_pub));
   if (NULL == session)
     session = postgres_get_session (pc);
+  if (NULL == session)
+    return GNUNET_DB_STATUS_HARD_ERROR;
   return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
                                                    "get_coin_denomination",
                                                    params,
@@ -3475,6 +3483,8 @@ postgres_get_melt (void *cls,
   melt->session.coin.denom_sig.rsa_signature = NULL;
   if (NULL == session)
     session = postgres_get_session (pg);
+  if (NULL == session)
+    return GNUNET_DB_STATUS_HARD_ERROR;
   qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn,
                                                  "get_melt",
                                                  params,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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