diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-01-27 14:10:27 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-01-27 14:10:40 +0100 |
commit | c239ba6f18ee7d62b249c7204dbe50dab37912b8 (patch) | |
tree | 27ccb16a15da81900d5a622417b95c5c172d9dc6 /src/exchange/taler-exchange-httpd_kyc-wallet.c | |
parent | 7e8e2f43178139b35f726dd0584ef629e1853af8 (diff) |
address DB failure error handling in KYC check
Diffstat (limited to 'src/exchange/taler-exchange-httpd_kyc-wallet.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-wallet.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/exchange/taler-exchange-httpd_kyc-wallet.c b/src/exchange/taler-exchange-httpd_kyc-wallet.c index 1111b678..515d84b6 100644 --- a/src/exchange/taler-exchange-httpd_kyc-wallet.c +++ b/src/exchange/taler-exchange-httpd_kyc-wallet.c @@ -109,22 +109,34 @@ wallet_kyc_check (void *cls, struct KycRequestContext *krc = cls; enum GNUNET_DB_QueryStatus qs; - krc->required = TALER_KYCLOGIC_kyc_test_required ( + qs = TALER_KYCLOGIC_kyc_test_required ( TALER_KYCLOGIC_KYC_TRIGGER_WALLET_BALANCE, &krc->h_payto, TEH_plugin->select_satisfied_kyc_processes, TEH_plugin->cls, &balance_iterator, - krc); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "KYC check required at %s is `%s'\n", - TALER_amount2s (&krc->balance), - krc->required); + krc, + &krc->required); + if (qs < 0) + { + if (GNUNET_DB_STATUS_SOFT_ERROR == qs) + return qs; + GNUNET_break (0); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + "kyc_test_required"); + return qs; + } if (NULL == krc->required) { krc->kyc.ok = true; return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "KYC check required at %s is `%s'\n", + TALER_amount2s (&krc->balance), + krc->required); krc->kyc.ok = false; qs = TEH_plugin->insert_kyc_requirement_for_account (TEH_plugin->cls, krc->required, |