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 library pub.error_group; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 /// An [ErrorGroup] entangles the errors of multiple [Future]s and [Stream]s | 7 /// An [ErrorGroup] entangles the errors of multiple [Future]s and [Stream]s |
10 /// with one another. | 8 /// with one another. |
11 /// | 9 /// |
12 /// This allows APIs to expose multiple [Future]s and [Stream]s that have | 10 /// This allows APIs to expose multiple [Future]s and [Stream]s that have |
13 /// identical error conditions without forcing API consumers to attach error | 11 /// identical error conditions without forcing API consumers to attach error |
14 /// handling to objects they don't care about. | 12 /// handling to objects they don't care about. |
15 /// | 13 /// |
16 /// To use an [ErrorGroup], register [Future]s and [Stream]s with it using | 14 /// To use an [ErrorGroup], register [Future]s and [Stream]s with it using |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 void _signalError(var e, [StackTrace stackTrace]) { | 286 void _signalError(var e, [StackTrace stackTrace]) { |
289 if (_isDone) return; | 287 if (_isDone) return; |
290 _subscription.cancel(); | 288 _subscription.cancel(); |
291 // Call these asynchronously to work around issue 7913. | 289 // Call these asynchronously to work around issue 7913. |
292 new Future.value().then((_) { | 290 new Future.value().then((_) { |
293 _controller.addError(e, stackTrace); | 291 _controller.addError(e, stackTrace); |
294 _controller.close(); | 292 _controller.close(); |
295 }); | 293 }); |
296 } | 294 } |
297 } | 295 } |
OLD | NEW |