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

Unified Diff: sdk/lib/io/io_sink.dart

Issue 2822173002: Warn when adding something to a closed sink and improve documentation (Closed)
Patch Set: Improve documentation (issue 29122). Created 3 years, 8 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
« sdk/lib/core/sink.dart ('K') | « sdk/lib/core/sink.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/io_sink.dart
diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart
index bae95792db6edafc5d70b7833865b6a8a0eb612b..75c8d9877e40f7cec26513d8bfb7214fc69af7a2 100644
--- a/sdk/lib/io/io_sink.dart
+++ b/sdk/lib/io/io_sink.dart
@@ -148,11 +148,12 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
_StreamSinkImpl(this._target);
void add(T data) {
- if (_isClosed) return;
+ if (_isClosed) throw new StateError("StreamSink is closed");
_controller.add(data);
}
void addError(error, [StackTrace stackTrace]) {
+ if (_isClosed) throw new StateError("StreamSink is closed");
_controller.addError(error, stackTrace);
}
« sdk/lib/core/sink.dart ('K') | « sdk/lib/core/sink.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698