fix: fix bug when creating customer who is redacted (#466)

This commit is contained in:
Nishant Joshi
2023-01-27 17:56:29 +05:30
committed by GitHub
parent 3381d207e2
commit 9e420d511d

View File

@ -75,9 +75,11 @@ pub async fn create_customer(
if error.current_context().is_db_unique_violation() { if error.current_context().is_db_unique_violation() {
db.find_customer_by_customer_id_merchant_id(customer_id, merchant_id) db.find_customer_by_customer_id_merchant_id(customer_id, merchant_id)
.await .await
.change_context(errors::ApiErrorResponse::InternalServerError) .map_err(|err| {
.attach_printable_lazy(|| { err.to_not_found_response(errors::ApiErrorResponse::InternalServerError)
format!("Failed while fetching Customer, customer_id: {customer_id}") .attach_printable(format!(
"Failed while fetching Customer, customer_id: {customer_id}",
))
})? })?
} else { } else {
Err(error Err(error