mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:30:32 +00:00
8760283247
A combination of `runZoned` and `runZonedGuarded` where only the latter allows an `onError` parameter, and only that has a nullable return type. Retains the `onError` parameter on `runZoned` for now because it's too breaking to remove it until packages have been migrated off of it. It will be removed in a follow-up CL. Change-Id: If0e86c8d14e13fa089c66f4af975aeacb2616cf6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137302 Reviewed-by: Jake Macdonald <jakemac@google.com> Reviewed-by: Nate Bosch <nbosch@google.com>
17 lines
502 B
Dart
17 lines
502 B
Dart
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import "package:expect/expect.dart";
|
|
import 'dart:async';
|
|
|
|
main() {
|
|
// Make sure `runZoned` returns the result of a synchronous call when an
|
|
// error handler is defined.
|
|
Expect.equals(
|
|
499,
|
|
runZonedGuarded(() => 499, (e, s) {
|
|
throw "Unexpected";
|
|
}));
|
|
}
|