-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
How to capture single error instance multiple times? #4059
Comments
Hi @itsramiel, the second If you add
The following code will report two exceptions: Sentry.captureException(new Error('test'), scope => {
scope.setTransactionName('transaction 1');
return scope;
});
Sentry.captureException(new Error('test'), scope => {
scope.setTransactionName('transaction 2');
return scope;
}); Details of the implementation are available here. |
But since they were captured under two different scopes/transaction, then does it make sense for it to still be dropped. |
@itsramiel I understand the sample code was simplified to showcase the behaviour, but do you have an example form your application were capturing the error multiple time would help you debug it? We capture the error the error once the first time, this should give you the context of error origin. You can overwrite the |
Sure, I use urql as my graphql client. When you create a client with urql and setup auth, you also pass a The issue is that when you make a graphql client call and an error is thrown by the query/mutation then the error is thrown at call site and also passed to the The problem is that if I wanted to capture the error also at call site, then it will not be picked up because it was already captured in One argument would be to not capture errors in
Sounds like an implementation detail that could change and this would no longer work |
Hi @itsramiel, let me create small simplified snippet, to confirm I understand the situation correctly. And maybe could function query() {
try {
queryInternal();
} catch (error) {
Sentry.captureException(error, (scope) => {
scope.setTag("transaction_1", true);
});
throw error;
}
}
Sentry.withScope((scope) => {
try {
scope.setTag("transaction_2", true);
query();
} catch (error) {
Sentry.captureException(error);
}
} In the sample the tags will be set in both cases. |
The example you provided will set both tags on the error captured inside the Let me try doing that |
@itsramiel Awesome, let us know if it works for you. |
@krystofwoldrich Closing as it is not critical for me and I am more aware of how this works now |
OS:
Platform:
SDK:
@sentry/react-native
(>= 1.0.0)react-native-sentry
(<= 0.43.2)SDK version: 5.31.1
react-native
version: 0.75.2Are you using Expo?
Are you using sentry.io or on-premise?
If you are using sentry.io, please post a link to your issue so we can take a look:
Link to issue
Configuration:
(
@sentry/react-native
)I have the following issue:
When I capture the same error two times, the second capture is not being reported on the website.
The reproducible here is redundant and is not very useful, but in an app I am working on it is more complicated. This example is just for the sake of reporting the issue
Steps to reproduce:
Actual result:
Only the first capture was reported:
Expected result:
I expect to see both on the website
The text was updated successfully, but these errors were encountered: