5

I want to "automatically" sent all errors from my React project to Sentry, and i mean absolutely ALL, from the code, from React, from Promises.

Is it realistic to set it up?

By init:

    import * as Sentry from '@sentry/browser';
    Sentry.init({ dsn: 'https://<key>@sentry.io/<project>' });

Sentry handles only "uncaught exceptions and unhandled rejections"

From docs:

"Automatically Capturing Errors

By including and configuring Sentry, the SDK will automatically attach global handlers to capture uncaught exceptions and unhandled rejections."

https://docs.sentry.io/platforms/javascript/#automatically-capturing-errors

1 Answer 1

4

You need to create a custom utility that Will call the capture exception method of Sentry. A solution could be to add this method to an ErrorBoundary, and attach the custom method inside the ErrorBoundary, Just take into account that the ErrorBoundary should be your parent Component.

Check a post of the Sentry team that refers to your doubt ErrorBoundary.

Error Boundary Docs

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.