Skip to content
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

LoadImageListIntegration won't throw bad state if there is no exceptions in the event #1347

Merged
merged 2 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

- LoadImageListIntegration won't throw bad state if there is no exceptions in the event ([#1347](https://github.com/getsentry/sentry-dart/pull/1347))

## 7.1.0

### Features
Expand Down
11 changes: 9 additions & 2 deletions flutter/lib/src/integrations/load_image_list_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ class LoadImageListIntegration extends Integration<SentryFlutterOptions> {

extension _NeedsSymbolication on SentryEvent {
bool needsSymbolication() {
if (this is SentryTransaction) return false;
if (this is SentryTransaction) {
return false;
}
if (exceptions?.isNotEmpty == false) {
return false;
}
final frames = exceptions?.first.stackTrace?.frames;
if (frames == null) return false;
if (frames == null) {
return false;
}
return frames.any((frame) => 'native' == frame.platform);
}
}
Expand Down
20 changes: 20 additions & 0 deletions flutter/test/integrations/load_image_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,26 @@ void main() {
expect('e77c5713-5311-28c2-ecf0-eb73fc39f450', image.debugId);
expect('test', image.debugFile);
});

test('Native layer is not called as there is no exceptions',
() async {
var called = false;

final sut = fixture.getSut();
fixture.channel
.setMockMethodCallHandler((MethodCall methodCall) async {
called = true;
return imageList;
});

sut.call(fixture.hub, fixture.options);

expect(fixture.options.eventProcessors.length, 1);

await fixture.hub.captureMessage('error');

expect(called, false);
});
});
}
});
Expand Down