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

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

Issue 14251006: Remove AsyncError with Expando. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebuild DOM and rebase. Created 7 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
Index: sdk/lib/async/stream.dart
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 264836af761322d3826ed57ed363d97e4531e43f..841ec58c85503927ddfd598d6f11c8f33f92f884 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -170,7 +170,7 @@ abstract class Stream<T> {
* is called. If [onData] is null, nothing happens.
*
* On errors from this stream, the [onError] handler is given a
- * [AsyncError] object describing the error.
+ * object describing the error.
*
* If this stream closes, the [onDone] handler is called.
*
@@ -178,7 +178,7 @@ abstract class Stream<T> {
* the first error is reported. The default is false.
*/
StreamSubscription<T> listen(void onData(T event),
- { void onError(AsyncError error),
+ { void onError(error),
void onDone(),
bool unsubscribeOnError});
@@ -217,7 +217,7 @@ abstract class Stream<T> {
* [Stream.transformEvent] to handle the event by writing a data event to
* the output sink
*/
- Stream<T> handleError(void handle(AsyncError error), { bool test(error) }) {
+ Stream<T> handleError(void handle( error), { bool test(error) }) {
return new _HandleErrorStream<T>(this, handle, test);
}
@@ -273,7 +273,7 @@ abstract class Stream<T> {
onError: result._setError,
onDone: () {
if (!seenFirst) {
- result._setError(new AsyncError(new StateError("No elements")));
+ result._setError(new StateError("No elements"));
} else {
result._setValue(value);
}
@@ -298,7 +298,7 @@ abstract class Stream<T> {
_cancelAndError(subscription, result)
);
},
- onError: (AsyncError e) {
+ onError: (e) {
result._setError(e);
},
onDone: () {
@@ -548,7 +548,7 @@ abstract class Stream<T> {
},
onError: future._setError,
onDone: () {
- future._setError(new AsyncError(new StateError("No elements")));
+ future._setError(new StateError("No elements"));
},
unsubscribeOnError: true);
return future;
@@ -577,7 +577,7 @@ abstract class Stream<T> {
future._setValue(result);
return;
}
- future._setError(new AsyncError(new StateError("No elements")));
+ future._setError(new StateError("No elements"));
},
unsubscribeOnError: true);
return future;
@@ -601,7 +601,7 @@ abstract class Stream<T> {
subscription.cancel();
// This is the second element we get.
Error error = new StateError("More than one element");
- future._setError(new AsyncError(error));
+ future._setError(error);
return;
}
foundResult = true;
@@ -613,7 +613,7 @@ abstract class Stream<T> {
future._setValue(result);
return;
}
- future._setError(new AsyncError(new StateError("No elements")));
+ future._setError(new StateError("No elements"));
},
unsubscribeOnError: true);
return future;
@@ -657,8 +657,7 @@ abstract class Stream<T> {
_runUserCode(defaultValue, future._setValue, future._setError);
return;
}
- future._setError(
- new AsyncError(new StateError("firstMatch ended without match")));
+ future._setError(new StateError("firstMatch ended without match"));
},
unsubscribeOnError: true);
return future;
@@ -701,8 +700,7 @@ abstract class Stream<T> {
_runUserCode(defaultValue, future._setValue, future._setError);
return;
}
- future._setError(
- new AsyncError(new StateError("lastMatch ended without match")));
+ future._setError(new StateError("lastMatch ended without match"));
},
unsubscribeOnError: true);
return future;
@@ -729,8 +727,8 @@ abstract class Stream<T> {
if (isMatch) {
if (foundResult) {
subscription.cancel();
- future._setError(new AsyncError(
- new StateError('Multiple matches for "single"')));
+ future._setError(
+ new StateError('Multiple matches for "single"'));
return;
}
foundResult = true;
@@ -746,8 +744,7 @@ abstract class Stream<T> {
future._setValue(result);
return;
}
- future._setError(
- new AsyncError(new StateError("single ended without match")));
+ future._setError(new StateError("single ended without match"));
},
unsubscribeOnError: true);
return future;
@@ -778,8 +775,7 @@ abstract class Stream<T> {
},
onError: future._setError,
onDone: () {
- future._setError(new AsyncError(
- new StateError("Not enough elements for elementAt")));
+ future._setError(new StateError("Not enough elements for elementAt"));
},
unsubscribeOnError: true);
return future;
@@ -807,7 +803,7 @@ abstract class StreamSubscription<T> {
void onData(void handleData(T data));
/** Set or override the error event handler of this subscription. */
- void onError(void handleError(AsyncError error));
+ void onError(void handleError(error));
/** Set or override the done event handler of this subscription. */
void onDone(void handleDone());
@@ -854,7 +850,7 @@ abstract class EventSink<T> {
/** Create a data event */
void add(T event);
/** Create an async error. */
- void addError(AsyncError errorEvent);
+ void addError(errorEvent);
/** Request a stream to close. */
void close();
}
@@ -871,7 +867,7 @@ class StreamView<T> extends Stream<T> {
Stream<T> asBroadcastStream() => _stream.asBroadcastStream();
StreamSubscription<T> listen(void onData(T value),
- { void onError(AsyncError error),
+ { void onError(error),
void onDone(),
bool unsubscribeOnError }) {
return _stream.listen(onData, onError: onError, onDone: onDone,
@@ -888,7 +884,7 @@ class _EventSinkView<T> extends EventSink<T> {
_EventSinkView(this._sink);
void add(T value) { _sink.add(value); }
- void addError(AsyncError error) { _sink.addError(error); }
+ void addError(error) { _sink.addError(error); }
void close() { _sink.close(); }
}
@@ -967,7 +963,7 @@ abstract class StreamTransformer<S, T> {
*/
factory StreamTransformer({
void handleData(S data, EventSink<T> sink),
- void handleError(AsyncError error, EventSink<T> sink),
+ void handleError(error, EventSink<T> sink),
void handleDone(EventSink<T> sink)}) {
return new _StreamTransformerImpl<S, T>(handleData,
handleError,
@@ -1051,7 +1047,7 @@ abstract class StreamEventTransformer<S, T> implements StreamTransformer<S, T> {
* The method may generate any number of events on the sink, but should
* not throw.
*/
- void handleError(AsyncError error, EventSink<T> sink) {
+ void handleError(error, EventSink<T> sink) {
sink.addError(error);
}
@@ -1083,7 +1079,7 @@ class EventTransformStream<S, T> extends Stream<T> {
: _source = source, _transformer = transformer;
StreamSubscription<T> listen(void onData(T data),
- { void onError(AsyncError error),
+ { void onError(error),
void onDone(),
bool unsubscribeOnError }) {
unsubscribeOnError = identical(true, unsubscribeOnError);
@@ -1110,7 +1106,7 @@ class _EventTransformStreamSubscription<S, T>
_EventTransformStreamSubscription(Stream<S> source,
this._transformer,
void onData(T data),
- void onError(AsyncError error),
+ void onError(error),
void onDone(),
this._unsubscribeOnError)
: super(onData, onError, onDone) {
@@ -1148,11 +1144,11 @@ class _EventTransformStreamSubscription<S, T>
}
}
- void _handleError(AsyncError error) {
+ void _handleError(error) {
try {
_transformer.handleError(error, _sink);
} catch (e, s) {
- _sendError(_asyncError(e, s, error));
+ _sendError(_asyncError(e, s));
}
}
@@ -1171,7 +1167,7 @@ class _EventTransformStreamSubscription<S, T>
_onData(data);
}
- void _sendError(AsyncError error) {
+ void _sendError(error) {
if (_isClosed) return;
_onError(error);
if (_unsubscribeOnError) {
@@ -1195,6 +1191,6 @@ class _EventOutputSinkWrapper<T> extends EventSink<T> {
_EventOutputSinkWrapper(this._sink);
void add(T data) { _sink._sendData(data); }
- void addError(AsyncError error) { _sink._sendError(error); }
+ void addError(error) { _sink._sendError(error); }
void close() { _sink._sendDone(); }
}

Powered by Google App Engine
This is Rietveld 408576698