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

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

Issue 1010403002: Ensure that stack traces are propagated more often in dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tab to space Created 5 years, 9 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 | « sdk/lib/io/http_parser.dart ('k') | sdk/lib/io/secure_server_socket.dart » ('j') | 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 0c2752244994d403db9773487ce45177bf22ba35..78c15fa83ca51fb21091a2eb965152f7452d0ae8 100644
--- a/sdk/lib/io/io_sink.dart
+++ b/sdk/lib/io/io_sink.dart
@@ -143,8 +143,9 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
_controller.add(data);
}
- void addError(error, [StackTrace stackTrace]) =>
- _controller.addError(error, stackTrace);
+ void addError(error, [StackTrace stackTrace]) {
+ _controller.addError(error, stackTrace);
+ }
Future addStream(Stream<T> stream) {
if (_isBound) {
@@ -196,21 +197,21 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
}
void _closeTarget() {
- _target.close()
- .then((value) => _completeDone(value: value),
- onError: (error) => _completeDone(error: error));
+ _target.close().then(_completeDoneValue, onError: _completeDoneError);
}
Future get done => _doneFuture;
- void _completeDone({value, error}) {
+ void _completeDoneValue(value) {
if (_doneCompleter == null) return;
- if (error == null) {
- _doneCompleter.complete(value);
- } else {
- _hasError = true;
- _doneCompleter.completeError(error);
- }
+ _doneCompleter.complete(value);
+ _doneCompleter = null;
+ }
+
+ void _completeDoneError(error, StackTrace stackTrace) {
+ if (_doneCompleter == null) return;
+ _hasError = true;
+ _doneCompleter.completeError(error, stackTrace);
_doneCompleter = null;
}
@@ -237,16 +238,16 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
_closeTarget();
}
},
- onError: (error) {
+ onError: (error, stackTrace) {
if (_isBound) {
// A new stream takes over - forward errors to that stream.
- _controllerCompleter.completeError(error);
+ _controllerCompleter.completeError(error, stackTrace);
_controllerCompleter = null;
_controllerInstance = null;
} else {
// No new stream. No need to close target, as it have already
// failed.
- _completeDone(error: error);
+ _completeDoneError(error, stackTrace);
}
});
}
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | sdk/lib/io/secure_server_socket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698