Skip to content

Commit

Permalink
Merge branch 'main' into deps/flutter/scripts/update-android.sh/6.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Jul 20, 2022
2 parents 50dc5ca + 287b3ad commit b64eaa4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Expand Up @@ -4,7 +4,6 @@

### Fixes

* Breadcrumbs should not be duplicated if there is no mechanism on Android ([#936](https://github.com/getsentry/sentry-dart/pull/936))
* Maps with Key Object, Object would fail during serialization if not String, Object ([#935](https://github.com/getsentry/sentry-dart/pull/935))

### Features
Expand Down
9 changes: 5 additions & 4 deletions dart/lib/src/sentry_client.dart
Expand Up @@ -378,11 +378,12 @@ class SentryClient {
}

SentryEvent _eventWithRemovedBreadcrumbsIfHandled(SentryEvent event) {
final foundNotHandled = event.exceptions
?.any((element) => element.mechanism?.handled == false) ??
false;
final exceptions = event.exceptions ?? [];
final handled = exceptions.isNotEmpty
? exceptions.first.mechanism?.handled == true
: false;

if (!foundNotHandled) {
if (handled) {
return event.copyWith(breadcrumbs: []);
} else {
return event;
Expand Down
22 changes: 0 additions & 22 deletions dart/test/sentry_client_test.dart
Expand Up @@ -898,28 +898,6 @@ void main() {
expect((capturedEvent.breadcrumbs ?? []).isEmpty, true);
});

test('Clears breadcrumbs on Android if theres no mechanism', () async {
fixture.options.enableScopeSync = true;
fixture.options.platformChecker =
MockPlatformChecker(platform: MockPlatform.android());

final client = fixture.getSut();
final event = SentryEvent(exceptions: [
SentryException(
type: "type",
value: "value",
)
], breadcrumbs: [
Breadcrumb()
]);
await client.captureEvent(event);

final capturedEnvelope = (fixture.transport).envelopes.first;
final capturedEvent = await eventFromEnvelope(capturedEnvelope);

expect((capturedEvent.breadcrumbs ?? []).isEmpty, true);
});

test('Does not clear breadcrumbs on Android if mechanism.handled is false',
() async {
fixture.options.enableScopeSync = true;
Expand Down

0 comments on commit b64eaa4

Please sign in to comment.