mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 22:01:19 +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>
25 lines
622 B
Dart
25 lines
622 B
Dart
// Copyright (c) 2017, 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 'dart:async';
|
|
import 'dart:cli';
|
|
|
|
import 'package:async_helper/async_helper.dart';
|
|
import 'package:expect/expect.dart';
|
|
|
|
main() {
|
|
asyncStart();
|
|
Completer<bool> c = new Completer<bool>();
|
|
runZonedGuarded(() {
|
|
Timer.run(() {
|
|
asyncEnd();
|
|
throw "Error";
|
|
});
|
|
}, (e, s) {
|
|
Expect.isTrue(e is String);
|
|
c.complete(true);
|
|
});
|
|
Expect.isTrue(waitFor<bool>(c.future));
|
|
}
|