Skip to content

Commit 287b3ad

Browse files
authored
Revert "Breadcrumbs should not be duplicated if there is no mechaism on Android" (#940)
1 parent 5c37707 commit 287b3ad

File tree

3 files changed

+5
-27
lines changed

3 files changed

+5
-27
lines changed

CHANGELOG.md

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
### Fixes
66

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

109
### Features

dart/lib/src/sentry_client.dart

+5-4
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,12 @@ class SentryClient {
378378
}
379379

380380
SentryEvent _eventWithRemovedBreadcrumbsIfHandled(SentryEvent event) {
381-
final foundNotHandled = event.exceptions
382-
?.any((element) => element.mechanism?.handled == false) ??
383-
false;
381+
final exceptions = event.exceptions ?? [];
382+
final handled = exceptions.isNotEmpty
383+
? exceptions.first.mechanism?.handled == true
384+
: false;
384385

385-
if (!foundNotHandled) {
386+
if (handled) {
386387
return event.copyWith(breadcrumbs: []);
387388
} else {
388389
return event;

dart/test/sentry_client_test.dart

-22
Original file line numberDiff line numberDiff line change
@@ -898,28 +898,6 @@ void main() {
898898
expect((capturedEvent.breadcrumbs ?? []).isEmpty, true);
899899
});
900900

901-
test('Clears breadcrumbs on Android if theres no mechanism', () async {
902-
fixture.options.enableScopeSync = true;
903-
fixture.options.platformChecker =
904-
MockPlatformChecker(platform: MockPlatform.android());
905-
906-
final client = fixture.getSut();
907-
final event = SentryEvent(exceptions: [
908-
SentryException(
909-
type: "type",
910-
value: "value",
911-
)
912-
], breadcrumbs: [
913-
Breadcrumb()
914-
]);
915-
await client.captureEvent(event);
916-
917-
final capturedEnvelope = (fixture.transport).envelopes.first;
918-
final capturedEvent = await eventFromEnvelope(capturedEnvelope);
919-
920-
expect((capturedEvent.breadcrumbs ?? []).isEmpty, true);
921-
});
922-
923901
test('Does not clear breadcrumbs on Android if mechanism.handled is false',
924902
() async {
925903
fixture.options.enableScopeSync = true;

0 commit comments

Comments
 (0)