-
Notifications
You must be signed in to change notification settings - Fork 243
Add a smart error handling component. #392
Comments
Cool, would love to get more details. I found react-safe-render when searching for react error handling component, but I think you mean something else, something similar to react-redbox 👍 |
Yeah, sure thing, I am combining a few different libraries, creating a HOC that can be easily used -and that only activates for development mode (else it just returns the original component). So I recommend that it be used to wrap EVERY component. It's very similar to For example, I switched out my component with react redbox for the exact same code error (no other code changes). redbox displayed the following stacktrace:
Whilst mine produces:
Notice the line count differences. 😀 |
The one that has been implemented in |
Defo worth investigating this as an option @codepunkt - would much rather use something that is managed for us. |
I tried |
@birkir @codepunkt @ctrlplusb It seems like we could just use the Apart from being used in CRA, it seems like it is being used in a bunch of other places. Here and here are a couple of integration examples, and here is one in React Starter Kit. |
(a follow up to my above comment) Incase CRA's react-error-overlay is what we choose, here is a PR (by @Timer on another repo) for us to base this upon (as per Dan Abramov's tweet): react-cosmos/react-cosmos#484 (comment). It seems like it doesn't require much webpack changes to get going. |
Closing in favour of reacts error boundaries. |
I built one for a client project, it's kind a meld of a few tools out there to give a nice error overlay that prints errors with stacktraces. Super helpful when developing components as unhandled errors during the react render process are obscure at best.
The text was updated successfully, but these errors were encountered: