| 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 programatically to a `Future` or `Stream`. |
| 538 * | 538 * |
| 539 * When calling [Completer.completeError], [Stream.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] |
| 548 * once. Libraries that use intermediate controllers or completers might | 548 * once. Libraries that use intermediate controllers or completers might |
| 549 * end up invoking [errorCallback] multiple times. | 549 * end up invoking [errorCallback] multiple times. |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 handleUncaughtError: errorHandler); | 1459 handleUncaughtError: errorHandler); |
| 1460 } | 1460 } |
| 1461 Zone zone = Zone.current | 1461 Zone zone = Zone.current |
| 1462 .fork(specification: zoneSpecification, zoneValues: zoneValues); | 1462 .fork(specification: zoneSpecification, zoneValues: zoneValues); |
| 1463 if (onError != null) { | 1463 if (onError != null) { |
| 1464 return zone.runGuarded(body); | 1464 return zone.runGuarded(body); |
| 1465 } else { | 1465 } else { |
| 1466 return zone.run(body); | 1466 return zone.run(body); |
| 1467 } | 1467 } |
| 1468 } | 1468 } |
| OLD | NEW |