react-error-reporter
Simple error reporting using React components.
npm install --save react-error-reporter
Example
; <ErrorReporter captureException= console> <CaptureException error='Test Error' extra= contextToError: true /></ErrorReporter>
Advanced Example
;; <ErrorReporter captureException=consoleerror> <GraphQL queries= projects: ... render= { if queriesprojectserror return <CaptureException error=queriesprojectserror />; if queriesprojectsloading return <Loading />; return queriesprojectsdataprojects; } /></ErrorReporter>
API
<ErrorReporter />
Provides captureException
to the context
. Your app must be wrapped using this component.
type Props = : void
<CaptureException />
Captures exception, passing error
and extra
to captureException
handler. This components renders null
.
Captures exception on componentWillMount()
if the error
prop is set and componentDidUpdate()
if the error
props has changed and is set.
type Props = // optional error // will be passed to captureException() as the first argument. error: ?Error // passes extra data to captureException() // each item in array is passed to captureException(error, item0, item1) as respective argument after the error // for example extra={[{ test: 1 }, { test: 2 }]} // will call captureException(error, { test: 1 }, { test: 2 }) extra: ?Array<any>}