Skip to content

Commit

Permalink
Merge 4af64f6 into 4da6c0b
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrenskers authored Nov 15, 2022
2 parents 4da6c0b + 4af64f6 commit 9f1fe4c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Don't increase session's error count for dropped events (#2374)

## 7.31.0

### Features
Expand Down
10 changes: 10 additions & 0 deletions Sources/Sentry/SentryClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ - (SentryId *)captureException:(NSException *)exception
{
SentryEvent *event = [self buildExceptionEvent:exception];
event = [self prepareEvent:event withScope:scope alwaysAttachStacktrace:YES];

if (event != nil) {
session = [SentrySDK.currentHub incrementSessionErrors];
}

return [self sendEvent:event withSession:session withScope:scope];
}

Expand Down Expand Up @@ -220,6 +225,11 @@ - (SentryId *)captureError:(NSError *)error
{
SentryEvent *event = [self buildErrorEvent:error];
event = [self prepareEvent:event withScope:scope alwaysAttachStacktrace:YES];

if (event != nil) {
session = [SentrySDK.currentHub incrementSessionErrors];
}

return [self sendEvent:event withSession:session withScope:scope];
}

Expand Down
5 changes: 2 additions & 3 deletions Sources/Sentry/SentryHub.m
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ - (SentryId *)captureError:(NSError *)error

- (SentryId *)captureError:(NSError *)error withScope:(SentryScope *)scope
{
SentrySession *currentSession = [self incrementSessionErrors];
SentrySession *currentSession = _session;
SentryClient *client = _client;
if (nil != client) {
if (nil != currentSession) {
Expand All @@ -457,8 +457,7 @@ - (SentryId *)captureException:(NSException *)exception

- (SentryId *)captureException:(NSException *)exception withScope:(SentryScope *)scope
{
SentrySession *currentSession = [self incrementSessionErrors];

SentrySession *currentSession = _session;
SentryClient *client = _client;
if (nil != client) {
if (nil != currentSession) {
Expand Down
2 changes: 2 additions & 0 deletions Sources/Sentry/include/SentryHub+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ SentryHub (Private)
withScope:(SentryScope *)scope
additionalEnvelopeItems:(NSArray<SentryEnvelopeItem *> *)additionalEnvelopeItems;

- (nullable SentrySession *)incrementSessionErrors;

@end

NS_ASSUME_NONNULL_END

0 comments on commit 9f1fe4c

Please sign in to comment.