Creates a faulted task with the given error.
(Exception error)
| 175 | * Creates a faulted task with the given error. |
| 176 | */ |
| 177 | public static <TResult> Task<TResult> forError(Exception error) { |
| 178 | Task<TResult>.TaskCompletionSource tcs = Task.<TResult> create(); |
| 179 | tcs.setError(error); |
| 180 | return tcs.getTask(); |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Creates a cancelled task with the given error. |