You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import React from 'react';
const InvalidComponent = () => ({}); // render will fail, should not return an object
class ErrorTesting extends React.Component {
state = {
forceError: false,
error: false,
}
throwError = () => {
if (this.state.forceError) {
return <InvalidComponent />;
}
return null;
}
componentDidCatch(error, errorInfo) {
this.setState({ error: true });
if (typeof Raven !== 'undefined') {
Raven.captureException(
error,
{
extra: {
info: errorInfo,
logger: 'react.componentDidCatch',
props: this.props,
},
logger: 'react.componentDidCatch',
tags: {
componentName: (this.constructor.displayName || this.constructor.name || 'Component'),
},
}
);
}
}
render() {
if (this.state.error) return 'ooooops';
return (
<div>
{ this.throwError() }
<button onClick={() => this.setState({ forceError: true })}>
Do not click me!
</button>
</div>
);
}
}
export default ErrorTesting;
What is the expected behavior?
The request to sentry is made using default data, not passed into captureException.
It is calling captureException twice: first the default from raven, and again inside componentDidCatch.
It only works removing .install() from the setup, but it stops to capture exceptions outside this react component. Also, the documentation indicates to include it.
Testing on Firefox Developer Edition (60.0b15 (64-bit) and Google Chrome Beta (66.0.3359.117).
The text was updated successfully, but these errors were encountered:
@rodolfo3 it's caused by the React that's bubbling the event to global handler in Development Mode only, but not in production. Please read the explanation here: #1249 (comment)
I'll leave this issue open to remember that I have to mention this in the docs.
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
I just setup raven:
My component (using ES6 transpiled using babel):
What is the expected behavior?
The request to sentry is made using default data, not passed into
captureException
.It is calling
captureException
twice: first the default from raven, and again insidecomponentDidCatch
.It only works removing
.install()
from the setup, but it stops to capture exceptions outside this react component. Also, the documentation indicates to include it.Testing on Firefox Developer Edition (60.0b15 (64-bit) and Google Chrome Beta (66.0.3359.117).
The text was updated successfully, but these errors were encountered: