Skip to content
Closed
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
- Now the device context from Android is available in `BeforeSendCallback`
- Set ip_address to {{auto}} by default, even if sendDefaultPII is disabled ([#1665](https://github.com/getsentry/sentry-dart/pull/1665))
- Instead use the "Prevent Storing of IP Addresses" option in the "Security & Privacy" project settings on sentry.io

### Features

- Add support for exception aggregates ([#1866](https://github.com/getsentry/sentry-dart/pull/1866))
- Add support for exception aggregates for PlatformExceptions from Android ([#1998](https://github.com/getsentry/sentry-dart/pull/1998))

### Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,22 @@ class AndroidPlatformExceptionEventProcessor implements EventProcessor {
jvmThreads.add(first);
}

final eventExceptions = event.exceptions?.map((e) {
if (event.throwable is! PlatformException) {
return e;
}
return e.copyWith(
mechanism: Mechanism(
type: 'chained',
exceptionId: jvmExceptions.length,
parentId: 0,
),
);
});

return event.copyWith(
exceptions: [
...?event.exceptions,
...?eventExceptions,
...jvmExceptions,
],
threads: [
Expand Down Expand Up @@ -140,15 +153,18 @@ class _JvmExceptionFactory {
...?jvmException.suppressed,
];

return jvmExceptions.map((exception) {
return exception.toSentryException(nativePackageName);
return jvmExceptions.asMap().entries.map((indexedException) {
return indexedException.value
.toSentryException(nativePackageName, indexedException.key);
}).toList(growable: false);
}
}

extension on JvmException {
MapEntry<SentryException, SentryThread> toSentryException(
String nativePackageName) {
String nativePackageName,
int index,
) {
String? exceptionType;
String? module;
final typeParts = type?.split('.');
Expand All @@ -170,6 +186,12 @@ extension on JvmException {
stackTrace: SentryStackTrace(
frames: stackFrames.reversed.toList(growable: false),
),
mechanism: Mechanism(
type: index == 0 ? "sentry-flutter" : "chained",
exceptionId: index,
parentId: index == 0 ? null : index - 1,
isExceptionGroup: index == 0 ? true : null,
),
);

String threadName;
Expand Down