fix error reporting/handling

This commit is contained in:
Christian Grothoff 2020-07-05 16:32:15 +02:00
parent 49f466df40
commit 6eb32a65bf
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 31 additions and 11 deletions

View File

@ -1016,9 +1016,9 @@ create_wire_fee_for_method (void *cls,
af->wire_fee.currency)) ) af->wire_fee.currency)) )
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid or missing amount in `%s' under `%s'\n", "Invalid or missing amount for option `%s' in section `%s'\n",
section, opt,
opt); section);
*ret = GNUNET_SYSERR; *ret = GNUNET_SYSERR;
GNUNET_free (opt); GNUNET_free (opt);
break; break;
@ -1038,9 +1038,9 @@ create_wire_fee_for_method (void *cls,
af->closing_fee.currency)) ) af->closing_fee.currency)) )
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid or missing amount in `%s' under `%s'\n", "Invalid or missing amount for option `%s' in section `%s'\n",
section, opt,
opt); section);
*ret = GNUNET_SYSERR; *ret = GNUNET_SYSERR;
GNUNET_free (opt); GNUNET_free (opt);
break; break;

View File

@ -827,7 +827,7 @@ exchange_serve_process_config (void)
&TEH_master_public_key. &TEH_master_public_key.
eddsa_pub)) eddsa_pub))
{ {
fprintf (stderr, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid master public key given in exchange configuration."); "Invalid master public key given in exchange configuration.");
GNUNET_free (master_public_key_str); GNUNET_free (master_public_key_str);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -840,13 +840,17 @@ exchange_serve_process_config (void)
if (GNUNET_OK != if (GNUNET_OK !=
TEH_WIRE_init (TEH_cfg)) TEH_WIRE_init (TEH_cfg))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to setup wire subsystem\n");
return GNUNET_SYSERR; return GNUNET_SYSERR;
}
if (NULL == if (NULL ==
(TEH_plugin = TALER_EXCHANGEDB_plugin_load (TEH_cfg))) (TEH_plugin = TALER_EXCHANGEDB_plugin_load (TEH_cfg)))
{ {
fprintf (stderr, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to initialize DB subsystem\n"); "Failed to initialize DB subsystem\n");
TEH_WIRE_done (); TEH_WIRE_done ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -859,6 +863,8 @@ exchange_serve_process_config (void)
&serve_unixpath, &serve_unixpath,
&unixpath_mode)) &unixpath_mode))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to setup HTTPd subsystem\n");
TEH_WIRE_done (); TEH_WIRE_done ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }

View File

@ -341,6 +341,8 @@ TEH_WIRE_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
&ret); &ret);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error setting up bank accounts\n");
TEH_WIRE_done (); TEH_WIRE_done ();
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -349,6 +351,8 @@ TEH_WIRE_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
(0 == json_object_size (wire_fee_object)) ) (0 == json_object_size (wire_fee_object)) )
{ {
TEH_WIRE_done (); TEH_WIRE_done ();
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No bank accounts configured\n");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
wire_methods = json_pack ("{s:O, s:O, s:o}", wire_methods = json_pack ("{s:O, s:O, s:o}",

View File

@ -1812,8 +1812,12 @@ postgres_iterate_denomination_info (void *cls,
.cb_cls = cb_cls, .cb_cls = cb_cls,
.pg = pc .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", "denomination_iterate",
params, params,
&domination_cb_helper, &domination_cb_helper,
@ -3068,6 +3072,8 @@ postgres_get_known_coin (void *cls,
coin_info->coin_pub = *coin_pub; coin_info->coin_pub = *coin_pub;
if (NULL == session) if (NULL == session)
session = postgres_get_session (pc); session = postgres_get_session (pc);
if (NULL == session)
return GNUNET_DB_STATUS_HARD_ERROR;
return GNUNET_PQ_eval_prepared_singleton_select (session->conn, return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
"get_known_coin", "get_known_coin",
params, params,
@ -3107,6 +3113,8 @@ postgres_get_coin_denomination (
TALER_B2S (coin_pub)); TALER_B2S (coin_pub));
if (NULL == session) if (NULL == session)
session = postgres_get_session (pc); session = postgres_get_session (pc);
if (NULL == session)
return GNUNET_DB_STATUS_HARD_ERROR;
return GNUNET_PQ_eval_prepared_singleton_select (session->conn, return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
"get_coin_denomination", "get_coin_denomination",
params, params,
@ -3475,6 +3483,8 @@ postgres_get_melt (void *cls,
melt->session.coin.denom_sig.rsa_signature = NULL; melt->session.coin.denom_sig.rsa_signature = NULL;
if (NULL == session) if (NULL == session)
session = postgres_get_session (pg); session = postgres_get_session (pg);
if (NULL == session)
return GNUNET_DB_STATUS_HARD_ERROR;
qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn, qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn,
"get_melt", "get_melt",
params, params,