Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sentry example only works on client side #3439

Closed
landvibe opened this issue Dec 12, 2017 · 1 comment
Closed

sentry example only works on client side #3439

landvibe opened this issue Dec 12, 2017 · 1 comment

Comments

@landvibe
Copy link

The sentry example does not handle server side exception.
I wonder why it is implemented in componentDidCatch which is called only on client side.
How about implementing it in pages/_error.js which can handle both side exceptions.

export default class ErrorPage extends React.Component {
  static getInitialProps({ res, err }) {
    const statusCode = res ? res.statusCode : err ? err.statusCode : null;
    if (IS_CLIENT) {
      // raven-js send event
    } else {
      // raven-node send event
    }
    return { statusCode };
  }
  ...
}
@landvibe
Copy link
Author

closed this because there is similar issue #1852.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant