Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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

### Enhancements

- Mark exceptions not handled by user as `handled: false` ([#1535](https://github.com/getsentry/sentry-dart/pull/1535))

## 7.8.0

### Enhancements
Expand Down
4 changes: 2 additions & 2 deletions dart/lib/src/run_zoned_guarded_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class RunZonedGuardedIntegration extends Integration<SentryOptions> {
stackTrace: stackTrace,
);

// runZonedGuarded doesn't crash the App.
final mechanism = Mechanism(type: 'runZonedGuarded', handled: true);
// runZonedGuarded doesn't crash the app, but is not handled by the user.
final mechanism = Mechanism(type: 'runZonedGuarded', handled: false);
final throwableMechanism = ThrowableMechanism(mechanism, exception);

final event = SentryEvent(
Expand Down
5 changes: 3 additions & 2 deletions dart/lib/src/sentry_isolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ class SentryIsolate {
stackTrace == null ? null : StackTrace.fromString(stackTrace),
);

// Isolate errors don't crash the App.
final mechanism = Mechanism(type: 'isolateError', handled: true);
// Isolate errors don't crash the app, but is not handled by the user.
final mechanism = Mechanism(type: 'isolateError', handled: false);
final throwableMechanism = ThrowableMechanism(mechanism, throwable);

final event = SentryEvent(
throwable: throwableMechanism,
level: SentryLevel.fatal,
Expand Down
7 changes: 2 additions & 5 deletions flutter/lib/src/integrations/flutter_error_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ class FlutterErrorIntegration implements Integration<SentryFlutterOptions> {
stackTrace: errorDetails.stack,
);

// FlutterError doesn't crash the App.
final mechanism = Mechanism(
type: 'FlutterError',
handled: true,
);
// FlutterError doesn't crash the app, but is not handled by the user.
final mechanism = Mechanism(type: 'FlutterError', handled: false);
final throwableMechanism = ThrowableMechanism(mechanism, exception);

var event = SentryEvent(
Expand Down
6 changes: 3 additions & 3 deletions flutter/test/integrations/flutter_error_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void main() {

final throwableMechanism = event.throwableMechanism as ThrowableMechanism;
expect(throwableMechanism.mechanism.type, 'FlutterError');
expect(throwableMechanism.mechanism.handled, true);
expect(throwableMechanism.mechanism.handled, false);
expect(throwableMechanism.throwable, exception);

expect(event.contexts['flutter_error_details']['library'], 'sentry');
Expand Down Expand Up @@ -102,7 +102,7 @@ void main() {

final throwableMechanism = event.throwableMechanism as ThrowableMechanism;
expect(throwableMechanism.mechanism.type, 'FlutterError');
expect(throwableMechanism.mechanism.handled, true);
expect(throwableMechanism.mechanism.handled, false);

expect(event.contexts['flutter_error_details']['library'], 'sentry');
expect(event.contexts['flutter_error_details']['context'],
Expand All @@ -126,7 +126,7 @@ void main() {

final throwableMechanism = event.throwableMechanism as ThrowableMechanism;
expect(throwableMechanism.mechanism.type, 'FlutterError');
expect(throwableMechanism.mechanism.handled, true);
expect(throwableMechanism.mechanism.handled, false);
expect(throwableMechanism.mechanism.data['hint'], isNull);

expect(event.contexts['flutter_error_details'], isNull);
Expand Down