Skip to content

Commit

Permalink
Fix: Always call Flutter.onError (#533)
Browse files Browse the repository at this point in the history
* fix

* Update CHANGELOG.md

* Update flutter/lib/src/default_integrations.dart

Co-authored-by: Manoel Aranda Neto <[email protected]>
  • Loading branch information
ueman and marandaneto authored Jul 19, 2021
1 parent 78678b2 commit 13a9705
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased

* Enhancement: Call `toString()` on all non-serializable fields (#528)
* Fix: Always call `Flutter.onError` in order to not swallow messages (#533)

# 6.0.0-beta.2

Expand Down
12 changes: 6 additions & 6 deletions flutter/lib/src/default_integrations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ class FlutterErrorIntegration extends Integration<SentryFlutterOptions> {
);

await hub.captureEvent(event, stackTrace: errorDetails.stack);

// call original handler
if (_defaultOnError != null) {
_defaultOnError!(errorDetails);
}

// we don't call Zone.current.handleUncaughtError because we'd like
// to set a specific mechanism for FlutterError.onError.
} else {
Expand All @@ -78,6 +72,12 @@ class FlutterErrorIntegration extends Integration<SentryFlutterOptions> {
'if you wish to capture silent errors',
);
}
// Call original handler, regardless of `errorDetails.silent` or
// `reportSilentFlutterErrors`. This ensures, that we don't swallow
// messages.
if (_defaultOnError != null) {
_defaultOnError!(errorDetails);
}
};
FlutterError.onError = _integrationOnError;

Expand Down

0 comments on commit 13a9705

Please sign in to comment.