OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.async; | 5 part of dart.async; |
6 | 6 |
7 typedef R ZoneCallback<R>(); | 7 typedef R ZoneCallback<R>(); |
8 typedef R ZoneUnaryCallback<R, T>(T arg); | 8 typedef R ZoneUnaryCallback<R, T>(T arg); |
9 typedef R ZoneBinaryCallback<R, T1, T2>(T1 arg1, T2 arg2); | 9 typedef R ZoneBinaryCallback<R, T1, T2>(T1 arg1, T2 arg2); |
10 | 10 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 * if (runGuarded) { | 527 * if (runGuarded) { |
528 * return (arg1, arg2) => this.runBinaryGuarded(registered, arg); | 528 * return (arg1, arg2) => this.runBinaryGuarded(registered, arg); |
529 * } | 529 * } |
530 * return (arg1, arg2) => thin.runBinary(registered, arg1, arg2); | 530 * return (arg1, arg2) => thin.runBinary(registered, arg1, arg2); |
531 */ | 531 */ |
532 ZoneBinaryCallback<R, T1, T2> bindBinaryCallback<R, T1, T2>( | 532 ZoneBinaryCallback<R, T1, T2> bindBinaryCallback<R, T1, T2>( |
533 R action(T1 argument1, T2 argument2), | 533 R action(T1 argument1, T2 argument2), |
534 {bool runGuarded: true}); | 534 {bool runGuarded: true}); |
535 | 535 |
536 /** | 536 /** |
537 * Intercepts errors when added programatically to a `Future` or `Stream`. | 537 * Intercepts errors when added programmatically to a `Future` or `Stream`. |
538 * | 538 * |
539 * When calling [Completer.completeError], [StreamController.addError], | 539 * When calling [Completer.completeError], [StreamController.addError], |
540 * or some [Future] constructors, the current zone is allowed to intercept | 540 * or some [Future] constructors, the current zone is allowed to intercept |
541 * and replace the error. | 541 * and replace the error. |
542 * | 542 * |
543 * Future constructors invoke this function when the error is received | 543 * Future constructors invoke this function when the error is received |
544 * directly, for example with [Future.error], or when the error is caught | 544 * directly, for example with [Future.error], or when the error is caught |
545 * synchronously, for example with [Future.sync]. | 545 * synchronously, for example with [Future.sync]. |
546 * | 546 * |
547 * There is no guarantee that an error is only sent through [errorCallback] | 547 * There is no guarantee that an error is only sent through [errorCallback] |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 handleUncaughtError: errorHandler); | 1460 handleUncaughtError: errorHandler); |
1461 } | 1461 } |
1462 Zone zone = Zone.current | 1462 Zone zone = Zone.current |
1463 .fork(specification: zoneSpecification, zoneValues: zoneValues); | 1463 .fork(specification: zoneSpecification, zoneValues: zoneValues); |
1464 if (onError != null) { | 1464 if (onError != null) { |
1465 return zone.runGuarded(body); | 1465 return zone.runGuarded(body); |
1466 } else { | 1466 } else { |
1467 return zone.run(body); | 1467 return zone.run(body); |
1468 } | 1468 } |
1469 } | 1469 } |
OLD | NEW |