Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAT-5467] fix(react-native): Ensure unhandled promise rejections are logged out #1235

Merged
merged 4 commits into from
Jan 13, 2021

Conversation

bengourley
Copy link
Contributor

Goal

When adding the onUnhandled event to the rejection tracker, it inadvertantly prevents the "possibly unhandled rejection" warning from displaying.

Fixes #1135.

Design

Unfortunately there was no way to import or reference the original function, so it needed to be copied into this repo. The risk here is that it gets out of date with the original.

Changeset

Added warning log that only gets printed in dev (as per the default).

Testing

Unit tests were updated and manual tests were run.

@github-actions
Copy link

github-actions bot commented Jan 13, 2021

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 40.70 kB 12.54 kB
After 40.70 kB 12.54 kB
± No change No change

Generated by 🚫 dangerJS against 698cacd

}
})
return () => rnPromise.disable()
}
}

// this function is copied in from the promise module, since it's not exported and we can't reference it:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need to add the license here too; I guess this isn't a "substantial portion" so maybe not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem that substantial to me but IANAL 🤷

@bengourley bengourley merged commit 7167a81 into next Jan 13, 2021
@bengourley bengourley deleted the fix/rn-promise-rejection-warning branch January 13, 2021 12:27
@imjoehaines imjoehaines mentioned this pull request Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

React-native: Async function swallowing console error
2 participants