chargebee-js-wrappers icon indicating copy to clipboard operation
chargebee-js-wrappers copied to clipboard

Add error handler when calling load('components')

Open doubleppereira opened this issue 4 years ago • 1 comments

Problem

Currently the react-wrapper doesn't allow to handle an error when calling load with an incorrect config.

If we do a init of a wrong config:

const chargebeeInstance = Chargebee.init({
  site: "site-name2", // wrong site
  domain: "https://mybilling.acme.com" // this is an optional parameter.
  publishableKey: "test__"
})

and we want to instantiate a CardComponent

The CardComponent will still be created even with a wrong configuration

Proposal

To allow the client to handle the error properly. Maybe having an onError handle event and a fallback component to render a custom error component in the render

doubleppereira avatar Dec 28 '20 16:12 doubleppereira