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

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

Issue 2857393003: Adding to a closed sink throws.
Patch Set: Rebase Created 3 years, 7 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 | « CHANGELOG.md ('k') | sdk/lib/io/io_sink.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream_transformers.dart
diff --git a/sdk/lib/async/stream_transformers.dart b/sdk/lib/async/stream_transformers.dart
index 27f1547fc4e30ec2da46806f0b3f41ff8f8fac0e..640d31c8e390aa8aedd9633c1f2a5aacdc21fcb6 100644
--- a/sdk/lib/async/stream_transformers.dart
+++ b/sdk/lib/async/stream_transformers.dart
@@ -220,17 +220,9 @@ class _HandlerEventSink<S, T> implements EventSink<S> {
bool get _isClosed => _sink == null;
- _reportClosedSink() {
- // TODO(29554): throw a StateError, and don't just report the problem.
- Zone.ROOT
- ..print("Sink is closed and adding to it is an error.")
- ..print(" See http://dartbug.com/29554.")
- ..print(StackTrace.current.toString());
- }
-
void add(S data) {
if (_isClosed) {
- _reportClosedSink();
+ throw new StateError("Sink is closed");
}
if (_handleData != null) {
_handleData(data, _sink);
@@ -241,7 +233,7 @@ class _HandlerEventSink<S, T> implements EventSink<S> {
void addError(Object error, [StackTrace stackTrace]) {
if (_isClosed) {
- _reportClosedSink();
+ throw new StateError("Sink is closed");
}
if (_handleError != null) {
_handleError(error, stackTrace, _sink);
« no previous file with comments | « CHANGELOG.md ('k') | sdk/lib/io/io_sink.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698