Scope passed on `captureException` is not consistent on sentry dashboard
See original GitHub issue- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
-
@sentry/browser
-
@sentry/node
-
raven-js
-
raven-node
(raven for node) - other: @sentry/nextjs
Version:
^6.13.3
Description
I am capturing some errors and I try to add the scope like so:
function captureError({ severity = Severity.Error, error, failScope, extras }: CaptureErrorArgs) {
withScope(function (scope) {
scope.setTag('fail-scope', failScope);
scope.setLevel(severity);
extras && scope.setExtras(extras);
captureException(error);
});
}
Problem is that the errors on sentry dashboard have the scope sometimes and sometimes they dont.
I have tried all the different ways to pass the scope in the capture exception but none seems to work. Any help?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Capturing Errors | Sentry Documentation
Capture Exception. Open the views.py file. Notice that we import sentry_sdk lib which contains the capture_exception method:.
Read more >React Error Handling And Reporting With Error Boundary And ...
With this setup, Sentry sends all errors captured by our error boundary to our issue dashboard using the Sentry.captureException method. Sentry ...
Read more >JavaScript - Docs - Sentry Documentation
Start by capturing an exception: Sentry.captureException(new Error("Something broke"));. Then, you can see the error in your dashboard:.
Read more >Track Errors in Ruby on Rails Application with Sentry
Project Link: https://github.com/Joker666/sentry-rails Error tracking is ... Unless we track these, we do not have full visibility into the ...
Read more >getsentry/dotnet - Gitter
takes an argument there but IIRC the data goes as Extra and not as Tag. using(_logger.BeginScope(“my data”)) _logger.LogError(“uses Sentry without ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @paschalidi,
Errors caught by
<ErrorBoundary />
are captured by Sentry SDK, and by design, anError
instance can only be captured once by Sentry to avoid duplication, as there are multiple levels of error handling inside SDK (details).So, the
Error
instance passed toonError
handler can’t be recaptured, as it’s already captured beforehand. Currently, there’s no way to skip SDK side capture forErrorBoundary
.captureMessage
will work instead, because it’s not subject to duplicate error checks.However, you can use
beforeCapture
handle to settags
/extras
and such to errors, just before Sentry captures them.The example below should modify the scope before the original
captureException
call on the SDK side, without creating a duplicate event.Hey @onurtemizkan thanks for explaining 😃