chore: add .attach_printable for InternalServerError (#368)

This commit is contained in:
Nishant Joshi
2023-01-17 17:23:57 +05:30
committed by GitHub
parent fb8d67a9f3
commit be9889b47a
14 changed files with 178 additions and 48 deletions

View File

@ -70,7 +70,13 @@ pub async fn get_customer_mandates(
.store
.find_mandate_by_merchant_id_customer_id(&merchant_account.merchant_id, &req.customer_id)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)?;
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable_lazy(|| {
format!(
"Failed while finding mandate: merchant_id: {}, customer_id: {}",
merchant_account.merchant_id, req.customer_id
)
})?;
if mandates.is_empty() {
Err(report!(errors::ApiErrorResponse::MandateNotFound).attach_printable("No Mandate found"))