Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2466)

Unified Diff: sdk/lib/async/stream_controller.dart

Issue 11826050: Consider a thrown AsyncError from a future/stream handler a rethrow. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Add tests. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/async/stream.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream_controller.dart
diff --git a/sdk/lib/async/stream_controller.dart b/sdk/lib/async/stream_controller.dart
index 61d0ad8ea999f620c959d0a3598a498ea3643dd8..b59f013bfdd1c208cd9df01074abd3c9a1e66974 100644
--- a/sdk/lib/async/stream_controller.dart
+++ b/sdk/lib/async/stream_controller.dart
@@ -85,10 +85,24 @@ class StreamController<T> extends Stream<T> implements StreamSink<T> {
/**
* Send or enqueue an error event.
*
+ * If [error] is not an [AsyncError], [exception] and an optional [stackTrace]
+ * is combined into an [AsyncError] and sent this stream's listeners.
+ *
+ * Itherwise, if [error] is an [AsyncError], it is used directly as the
+ * error object reported to listeners, and the [stackTrace] is ignored.
+ *
* If a subscription has requested to be unsubscribed on errors,
* it will be unsubscribed after receiving this event.
*/
- void signalError(AsyncError error) { _stream._signalError(error); }
+ void signalError(Object error, [Object stackTrace]) {
+ AsyncError asyncError;
+ if (error is AsyncError) {
+ asyncError = error;
+ } else {
+ asyncError = new AsyncError(error, stackTrace);
+ }
+ _stream._signalError(asyncError);
+ }
/**
* Send or enqueue a "done" message.
« no previous file with comments | « sdk/lib/async/stream.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698