React-native: Async function swallowing console error
See original GitHub issueDescribe the bug
When an exception occurs in a component function with the async keyword in the signature, the error is not being logged to the console.
Steps to reproduce
- Pull down this repo’s master branch and run (linked below). This is a clone of the rn063example folder with the changes in App.js to reproduce what I am experiencing.
- When the app is running, click the red text button.
- Doing this is when I did not see the console error.
Environment
- Bugsnag version: 7.3.0-alpha.12 (originally experienced on 7.5.2)
- Browser framework version (if any):
- React: 0.63.0 (originally experienced on 0.63.2)
- Device (e.g. iphonex): iPhone 11 (13.2.2) and Pixel 3 XL (API 29)
Example Repo
https://github.com/ShawnCholeva/bugsnag-async-func-error
Example code snippet
Error messages:
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Catch the error from an async function in react application ...
It is however still possible for async functions to mistakenly swallow errors. Take for example the parallel async function.
Read more >Error handling with async/await and promises, n² ... - CatchJS
Browsers now have native support for doing asynchronous calls via async / await . This is nice. It is essentially syntax support for...
Read more >Errors in async functions get swallowed · Issue #175 - GitHub
In this example, the error becomes the rejection reason for the Promise returned by the async function, so you'll want to catch it...
Read more >async function - JavaScript - MDN Web Docs - Mozilla
The async function declaration declares an async function where the await keyword is permitted within the function body. The async and await ...
Read more >Are JavaScript Promises swallowing your errors?
JavaScript Promises swallow your errors by default, causing untold pain while debugging. Learn how to keep yourself sane by handling errors ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @ShawnCholeva, thanks for raising providing the repro. Confirmed the behaviour you’re seeing. We’ll take a look into this.
When running without Bugsnag enabled, we’d expect to see a warning when a possible unhandled rejection occurs:
With Bugsnag enabled, this unhandled rejection error does get reported to Bugsnag, but it’s hidden from the console.
@mattdyoung this seems like it was improved in v7.6.0 but not really fixed. There is now a console log for
Possible Unhandled Promise Rejection (id: 1):
and a (not so useful bugsnag internals) stack but it still swallows the error message. That means you need to log into bugsnag to read any async error messages which isn’t ideal. Can this be reopened until error messages are no longer being swallowed in development?