I have tried to install sentry.io with raven.js in two ways, but none of them seems to catch the errors correctly...
<script src="https://cdn.ravenjs.com/3.20.1/raven.min.js" crossorigin="anonymous"></script>
raven-js via npmI wonder what kinds of error catching methods or utilities I can use in gatsby.js.
I can report the error manually using Raven.captureException(e), which is stated at https://docs.sentry.io/clients/javascript/usage/#raven-js-reporting-errors
The official documentation is available at https://docs.sentry.io/clients/javascript/integrations/react/
you can could instegrate an error boundary in src/HTML.js and log the error to sentry there.
Take a look into how Gatsby plugins for Google Analytics and Intercom.io work. You'll probably want to modify the onRenderBody hook of gatsby-ssr.js and cut-and-paste the JS in your raven.min.js file there so it is called before the page loads.
I actually made a plugin for this, you can find it here:
@octalmage awesome thanks!
Most helpful comment
I actually made a plugin for this, you can find it here:
https://www.npmjs.com/package/gatsby-plugin-sentry