-improve error handling

This commit is contained in:
Christian Grothoff 2022-05-21 01:39:34 +02:00
parent 421f59749e
commit 81ad77b8dc
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -1440,6 +1440,15 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
NULL); NULL);
} }
debit = TALER_xtalerbank_account_from_payto (debit_account); debit = TALER_xtalerbank_account_from_payto (debit_account);
if (NULL == debit)
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PAYTO_URI_MALFORMED,
debit_account);
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Receiving incoming wire transfer: %s->%s, subject: %s, amount: %s\n", "Receiving incoming wire transfer: %s->%s, subject: %s, amount: %s\n",
debit, debit,
@ -1560,6 +1569,15 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
int ret; int ret;
credit = TALER_xtalerbank_account_from_payto (credit_account); credit = TALER_xtalerbank_account_from_payto (credit_account);
if (NULL == credit)
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PAYTO_URI_MALFORMED,
credit_account);
}
ret = make_transfer (h, ret = make_transfer (h,
account, account,
credit, credit,
@ -1649,7 +1667,7 @@ struct HistoryArgs
uint64_t account_number; uint64_t account_number;
/** /**
* Index of the starting transaction. * Index of the starting transaction, exclusive (!).
*/ */
uint64_t start_idx; uint64_t start_idx;