OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.async; | 5 part of dart.async; |
6 | 6 |
7 // ------------------------------------------------------------------- | 7 // ------------------------------------------------------------------- |
8 // Core Stream types | 8 // Core Stream types |
9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
10 | 10 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 } | 496 } |
497 | 497 |
498 /** | 498 /** |
499 * Creates a wrapper Stream that intercepts some errors from this stream. | 499 * Creates a wrapper Stream that intercepts some errors from this stream. |
500 * | 500 * |
501 * If this stream sends an error that matches [test], then it is intercepted | 501 * If this stream sends an error that matches [test], then it is intercepted |
502 * by the [handle] function. | 502 * by the [handle] function. |
503 * | 503 * |
504 * The [onError] callback must be of type `void onError(error)` or | 504 * The [onError] callback must be of type `void onError(error)` or |
505 * `void onError(error, StackTrace stackTrace)`. Depending on the function | 505 * `void onError(error, StackTrace stackTrace)`. Depending on the function |
506 * type the the stream either invokes [onError] with or without a stack | 506 * type the stream either invokes [onError] with or without a stack |
507 * trace. The stack trace argument might be `null` if the stream itself | 507 * trace. The stack trace argument might be `null` if the stream itself |
508 * received an error without stack trace. | 508 * received an error without stack trace. |
509 * | 509 * |
510 * An asynchronous error [:e:] is matched by a test function if [:test(e):] | 510 * An asynchronous error [:e:] is matched by a test function if [:test(e):] |
511 * returns true. If [test] is omitted, every error is considered matching. | 511 * returns true. If [test] is omitted, every error is considered matching. |
512 * | 512 * |
513 * If the error is intercepted, the [handle] function can decide what to do | 513 * If the error is intercepted, the [handle] function can decide what to do |
514 * with it. It can throw if it wants to raise a new (or the same) error, | 514 * with it. It can throw if it wants to raise a new (or the same) error, |
515 * or simply return to make the stream forget the error. | 515 * or simply return to make the stream forget the error. |
516 * | 516 * |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1811 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
1812 EventSink _sink; | 1812 EventSink _sink; |
1813 _ControllerEventSinkWrapper(this._sink); | 1813 _ControllerEventSinkWrapper(this._sink); |
1814 | 1814 |
1815 void add(T data) { _sink.add(data); } | 1815 void add(T data) { _sink.add(data); } |
1816 void addError(error, [StackTrace stackTrace]) { | 1816 void addError(error, [StackTrace stackTrace]) { |
1817 _sink.addError(error, stackTrace); | 1817 _sink.addError(error, stackTrace); |
1818 } | 1818 } |
1819 void close() { _sink.close(); } | 1819 void close() { _sink.close(); } |
1820 } | 1820 } |
OLD | NEW |