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

Unified Diff: lib/stream_channel.dart

Issue 1669953002: Provide more error-handling customization. (Closed) Base URL: git@github.com:dart-lang/stream_channel.git@master
Patch Set: Created 4 years, 10 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
Index: lib/stream_channel.dart
diff --git a/lib/stream_channel.dart b/lib/stream_channel.dart
index 8c4fad5205dc48cfd115b5b6368645a3ba443945..992f7026a42558b5a5263eece0a48a5718698989 100644
--- a/lib/stream_channel.dart
+++ b/lib/stream_channel.dart
@@ -78,8 +78,13 @@ abstract class StreamChannel<T> {
/// [StreamChannel] documentation. This makes it somewhat less efficient than
/// just wrapping a stream and a sink directly, so [new StreamChannel] should
/// be used when the guarantees are provided natively.
- factory StreamChannel.withGuarantees(Stream<T> stream, StreamSink<T> sink) =>
- new GuaranteeChannel(stream, sink);
+ ///
+ /// If [allowSinkErrors] is `false`, errors are not allowed to be passed to
+ /// [sink]. If any are, the connection will close and the error will be
+ /// forwarded to [Sink.done].
+ factory StreamChannel.withGuarantees(Stream<T> stream, StreamSink<T> sink,
+ {bool allowSinkErrors: true}) =>
+ new GuaranteeChannel(stream, sink, allowSinkErrors: allowSinkErrors);
/// Connects [this] to [other], so that any values emitted by either are sent
/// directly to the other.

Powered by Google App Engine
This is Rietveld 408576698