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

Unified Diff: runtime/bin/socket_stream_impl.dart

Issue 10173024: Change the error handling in dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « runtime/bin/socket_impl.dart ('k') | runtime/bin/stream_util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_stream_impl.dart
diff --git a/runtime/bin/socket_stream_impl.dart b/runtime/bin/socket_stream_impl.dart
index 101bf489854d8f44e7d4508584ae463db937e63c..73338d947422efb6a6ad2ab6bbcb194061f52023 100644
--- a/runtime/bin/socket_stream_impl.dart
+++ b/runtime/bin/socket_stream_impl.dart
@@ -66,6 +66,10 @@ class _SocketInputStream implements SocketInputStream {
_socket._onClosed = _onClosed;
}
+ void set onError(void callback(e)) {
+ _onError = callback;
+ }
+
void _onClosed() {
_closed = true;
if (_clientCloseHandler !== null) {
@@ -73,19 +77,20 @@ class _SocketInputStream implements SocketInputStream {
}
}
- void set onError(void callback(Exception e)) {
- _errorCallback = callback;
- }
-
- void _onError(Exception e) {
+ void _onSocketError(e) {
close();
- if (_errorCallback != null) _errorCallback(e);
+ if (_onError != null) {
+ _onError(e);
+ return true;
+ } else {
+ return false;
+ }
}
Socket _socket;
bool _closed = false;
Function _clientCloseHandler;
- Function _errorCallback;
+ Function _onError;
}
@@ -181,19 +186,19 @@ class _SocketOutputStream
}
}
- void set onError(void callback(Exception e)) {
- _errorCallback = callback;
- }
-
- void _onError(Exception e) {
+ bool _onSocketError(e) {
close();
- if (_errorCallback != null) _errorCallback(e);
+ if (_onError != null) {
+ _onError(e);
+ return true;
+ } else {
+ return false;
+ }
}
Socket _socket;
_BufferList _pendingWrites;
var _onNoPendingWrites;
- Function _errorCallback;
bool _closing = false;
bool _closed = false;
}
« no previous file with comments | « runtime/bin/socket_impl.dart ('k') | runtime/bin/stream_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698