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() {
db.find_customer_by_customer_id_merchant_id(customer_id, merchant_id)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable_lazy(|| {
format!("Failed while fetching Customer, customer_id: {customer_id}")
.map_err(|err| {
err.to_not_found_response(errors::ApiErrorResponse::InternalServerError)
.attach_printable(format!(
"Failed while fetching Customer, customer_id: {customer_id}",
))
})?
} else {
Err(error