chargebee / chargebee-js-wrappers

25 stars 10 forks source link

Add error handler when calling load('components') #33

Open doubleppereira opened 3 years ago

doubleppereira commented 3 years ago

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

aseerkt commented 1 year ago

Hi @cb-jose Can I work on this?