OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 7 /** |
8 * An object representing a delayed computation. | 8 * An object representing a delayed computation. |
9 * | 9 * |
10 * A [Future] is used to represent a potential value, or error, | 10 * A [Future] is used to represent a potential value, or error, |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 * the future returned by `then` will be completed with | 426 * the future returned by `then` will be completed with |
427 * the same result as the future returned by the callback. | 427 * the same result as the future returned by the callback. |
428 * | 428 * |
429 * If [onError] is not given, and this future completes with an error, | 429 * If [onError] is not given, and this future completes with an error, |
430 * the error is forwarded directly to the returned future. | 430 * the error is forwarded directly to the returned future. |
431 * | 431 * |
432 * In most cases, it is more readable to use [catchError] separately, possibly | 432 * In most cases, it is more readable to use [catchError] separately, possibly |
433 * with a `test` parameter, instead of handling both value and error in a | 433 * with a `test` parameter, instead of handling both value and error in a |
434 * single [then] call. | 434 * single [then] call. |
435 */ | 435 */ |
436 Future/*<S>*/ then/*<S>*/(/*=S*/ onValue(T value), { Function onError }); | 436 Future/*<S>*/ then/*<S>*/(onValue(T value), { Function onError }); |
Leaf
2016/08/05 22:32:36
Presumably theres are corresponding patch to be co
Jennifer Messerly
2016/08/08 21:59:26
This is the main repo so it changes it here, but y
| |
437 | 437 |
438 /** | 438 /** |
439 * Handles errors emitted by this [Future]. | 439 * Handles errors emitted by this [Future]. |
440 * | 440 * |
441 * This is the asynchronous equivalent of a "catch" block. | 441 * This is the asynchronous equivalent of a "catch" block. |
442 * | 442 * |
443 * Returns a new [Future] that will be completed with either the result of | 443 * Returns a new [Future] that will be completed with either the result of |
444 * this future or the result of calling the `onError` callback. | 444 * this future or the result of calling the `onError` callback. |
445 * | 445 * |
446 * If this future completes with a value, | 446 * If this future completes with a value, |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
756 if (replacement != null) { | 756 if (replacement != null) { |
757 error = _nonNullError(replacement.error); | 757 error = _nonNullError(replacement.error); |
758 stackTrace = replacement.stackTrace; | 758 stackTrace = replacement.stackTrace; |
759 } | 759 } |
760 result._completeError(error, stackTrace); | 760 result._completeError(error, stackTrace); |
761 } | 761 } |
762 | 762 |
763 /** Helper function that converts `null` to a [NullThrownError]. */ | 763 /** Helper function that converts `null` to a [NullThrownError]. */ |
764 Object _nonNullError(Object error) => | 764 Object _nonNullError(Object error) => |
765 (error != null) ? error : new NullThrownError(); | 765 (error != null) ? error : new NullThrownError(); |
OLD | NEW |