question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stop converting thrown promise to new Error() in react-error-overlay

See original GitHub issue

Since suspense had released throwing a promise became so popular and everybody plays with it within create-react-app environment. When I was trying to create Suspense with component without using ReactFiber implementation I’ve faced an issue.

When I throw a promise react-error-overlay catches it with listeners and converts to new Error() and overlays my ErrorBoundaries with its own. https://github.com/facebook/create-react-app/blob/36ce5786f51f3c793d15178d530d2eb1ae26427a/packages/react-error-overlay/src/effects/unhandledError.js#L13-L26

Here is a sandbox where I’ve reproduced a problem: https://codesandbox.io/s/ww9rxlo15k

Maybe we can ignore thrown promises here and will popup overlay only when error thrown?

As a workaround without ejecting create-react-app I can remove error listener from window: https://stackoverflow.com/a/47400249/6717050

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vadimshvetsovcommented, Nov 8, 2018

@cloudever Yes, thats right, only works with 16.3, because there is no Suspense in ReactFiber implementation, but if I will switch to 16.6 and implement the same I can’t catch a promise because it get handled during reconciliation. I think it would be great to have an opportunity to create some sort of middleware libraries which could catch a promise and then throw it to the higher layer after doing something with it.

0reactions
vadimshvetsovcommented, Dec 8, 2018

I think we don’t need to implement Suspence components while they are already exists in reconciler code and works different, than we can expose in code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

create react app - Disable error overlay in development mode
The error overlay can be disabled by using the stopReportingRuntimeErrors helper utility in the react-error-overlay package.
Read more >
React Google Maps Api Style Guide
Additional map types to overlay. Overlay map types will display on top of the base map they are attached to, in the order...
Read more >
react-error-overlay - npm
react -error-overlay is an overlay which displays when there is a runtime error. Development. When developing within this package, make sure you ...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Build custom tooling or convert existing developer tools extensions to use in Web Inspector. Flexbox Inspector. Use the new visualization overlay in Web ......
Read more >
Promise reject does not propagate the error correctly in ...
In this article, we will try to understand why Promise's reject() method doesn't propagate the error correctly, and later we will see the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found