adaptyteam / AdaptySDK-React-Native

React Native SDK for growing in-app subscriptions
https://docs.adapty.io/docs/quickstart
MIT License
122 stars 12 forks source link

Adapty error is not of type Error #31

Closed idlework closed 1 year ago

idlework commented 1 year ago

The error object returned by Adapty is not of instance Error.

How to replicate:

try {
  const result = await adapty.purchases.makePurchase(product); // have this function generate an error
} catch (error) {
  console.log(error instanceof Error); // results in false
}

For us, this is a problem because Firebase Crashlytics only accepts error object with the Error instance. Now we had to find out that errors from clients are not monitored because the Adapty module does not have a correct instance type on its error object.

divanc commented 1 year ago

Hey, I've never given this a thought in JS! Fixed in v1.4. Thank you!

image

image