diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-01-27 14:19:14 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-01-27 14:19:14 +0100 |
commit | 42bd2dadcfad336623c0650c28580e8206bf95b9 (patch) | |
tree | 947a8777e0bc5651fe46c72736838ea43d781be9 /src/kyclogic/kyclogic_api.c | |
parent | c239ba6f18ee7d62b249c7204dbe50dab37912b8 (diff) | |
download | exchange-42bd2dadcfad336623c0650c28580e8206bf95b9.tar.xz |
address DB failure error handling in KYC check
Diffstat (limited to 'src/kyclogic/kyclogic_api.c')
-rw-r--r-- | src/kyclogic/kyclogic_api.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c index fdd814ae0..d7ecf51e1 100644 --- a/src/kyclogic/kyclogic_api.c +++ b/src/kyclogic/kyclogic_api.c @@ -1166,18 +1166,22 @@ TALER_KYCLOGIC_kyc_get_details ( } -bool +enum GNUNET_DB_QueryStatus TALER_KYCLOGIC_check_satisfied (const char *requirements, const struct TALER_PaytoHashP *h_payto, json_t **kyc_details, TALER_KYCLOGIC_KycSatisfiedIterator ki, - void *ki_cls) + void *ki_cls, + bool *satisfied) { struct TALER_KYCLOGIC_KycCheck *needed[num_kyc_checks]; unsigned int needed_cnt = 0; if (NULL == requirements) - return true; + { + *satisfied = true; + return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; + } { char *req = GNUNET_strdup (requirements); @@ -1204,7 +1208,12 @@ TALER_KYCLOGIC_check_satisfied (const char *requirements, h_payto, &remove_satisfied, &rc); - GNUNET_break (qs >= 0); // FIXME: handle DB failure more nicely? + if (qs < 0) + { + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + *satisfied = false; + return qs; + } if (0 != needed_cnt) { json_decref (rc.kyc_details); @@ -1215,7 +1224,8 @@ TALER_KYCLOGIC_check_satisfied (const char *requirements, *kyc_details = rc.kyc_details; } } - return (0 == needed_cnt); + *satisfied = (0 == needed_cnt); + return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; } |