Skip to content
Merged
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
use runZonedGuarded
  • Loading branch information
bruno-garcia committed May 19, 2020
commit a3085c4f0317fa5e85cefc73c1981d56e7b9ee50
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ main() async {
## Tips for catching errors

- Use a `try/catch` block, like in the example above.
- Create a `Zone` with an error handler, e.g. using [runZoned][run_zoned].
- Create a `Zone` with an error handler, e.g. using [runZonedGuarded][run_zoned_guarded].

```dart
var sentry = SentryClient(dsn: "https://...");
// Run the whole app in a zone to capture all uncaught errors.
runZoned(
runZonedGuarded(
() => runApp(MyApp()),
onError: (Object error, StackTrace stackTrace) {
(error, stackTrace) {
try {
sentry.captureException(
exception: error,
Expand Down Expand Up @@ -98,6 +98,6 @@ main() async {
Please file it at https://github.com/flutter/flutter/issues/new

[flutter]: https://flutter.dev
[run_zoned]: https://api.dartlang.org/stable/dart-async/runZoned.html
[run_zoned_guarded]: https://api.dartlang.org/stable/dart-async/runZonedGuarded.html
[flutter_error]: https://docs.flutter.io/flutter/foundation/FlutterError/onError.html
[angular_sentry]: https://pub.dev/packages/angular_sentry