Skip to content

Commit

Permalink
fix(payment): ensure that payment error is captured in logger (#10506)
Browse files Browse the repository at this point in the history
what:

- when an error occurs upon retrieving a provider, log the original error through the logger

Helps #10500 in debugging.
  • Loading branch information
riqwan authored Dec 9, 2024
1 parent f8f5d57 commit a04238a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clever-experts-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/payment": patch
---

fix(payment): ensure that payment error is captured in logger
5 changes: 4 additions & 1 deletion packages/modules/payment/src/services/payment-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export default class PaymentProviderService extends ModulesSdkUtils.MedusaIntern
Unable to retrieve the payment provider with id: ${providerId}
Please make sure that the provider is registered in the container and it is configured correctly in your project configuration file.
`
this.#logger.error(errMessage)

// Ensure that the logger captures the actual error
this.#logger.error(e)

throw new Error(errMessage)
}
}
Expand Down

0 comments on commit a04238a

Please sign in to comment.