React Transform that catches errors inside React components
by gaearonJavaScript
Last 12 weeks · 0 commits
2 of 6 standards met
Repository: gaearon/react-transform-catch-errors. Description: React Transform that catches errors inside React components Stars: 183, Forks: 20. Primary language: JavaScript. Languages: JavaScript (100%). Latest release: v1.0.2 (10y ago). Open PRs: 0, open issues: 4. Last activity: 9y ago. Community health: 42%. Top contributors: gaearon, jamiebuilds, jedwards1211, colinmeinke, davecoates, apaleslimghost, weblancaster, zalmoxisus, hoegrammer, smashercosmo and others.
Hi, I do exactly what you have written,but I got errors on the browser's console pannel,not on the page.
It would be great if there were some more documentation on how to use a local component as the ErrorReporter. I have been struggling with this for some time. Using relative paths did not work, and setting a webpack alias did not seem to work either. I get undefined as the value of ErrorReporter if I use a default export for the component: And i get an empty object if using module.exports.
At Taskworld we’re using this in production to be able to catch React rendering errors and display a graceful error message in a web app, and also to send an object containing props and state (stripped of sensitive data) to an error tracking system. This PR adds several addition props to pass to : The of the component that crashed. The state object of the component that crashed. The props passed to the component that crashed. (Previously, I’ve been monkeypatching to augment method with a try...catch block. Moving towards ES6 components, such monkeypatching isn’t possible anymore.)