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

Unified Diff: runtime/bin/socket_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.dart ('k') | runtime/bin/socket_stream_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_impl.dart
diff --git a/runtime/bin/socket_impl.dart b/runtime/bin/socket_impl.dart
index 93dc66ca346009bb23d937c66164e54b6eb21f1a..e4f11dbf25a061c5c967b5f8413336c9b7330b59 100644
--- a/runtime/bin/socket_impl.dart
+++ b/runtime/bin/socket_impl.dart
@@ -99,7 +99,7 @@ class _SocketBase {
OSError _getError() native "Socket_GetError";
int _getPort() native "Socket_GetPort";
- void set onError(void callback(Exception e)) {
+ void set onError(void callback(e)) {
_setHandler(_ERROR_EVENT, callback);
}
@@ -188,12 +188,15 @@ class _SocketBase {
bool _reportError(error, String message) {
void doReportError(Exception e) {
- // Invoke the error callback if any.
+ // Invoke the socket error callback if any.
+ bool reported = false;
if (_handlerMap[_ERROR_EVENT] != null) {
_handlerMap[_ERROR_EVENT](e);
+ reported = true;
}
// Propagate the error to any additional listeners.
- _propagateError(e);
+ reported = reported || _propagateError(e);
+ if (!reported) throw e;
}
// For all errors we close the socket, call the error handler and
@@ -222,7 +225,7 @@ class _SocketBase {
int hashCode() => _hashCode;
- void _propagateError(Exception e) => null;
+ bool _propagateError(Exception e) => null;
abstract bool _isListenSocket();
abstract bool _isPipe();
@@ -516,13 +519,15 @@ class _Socket extends _SocketBase implements Socket {
_setHandler(_SocketBase._CLOSE_EVENT, callback);
}
- void _propagateError(Exception e) {
+ bool _propagateError(Exception e) {
+ bool reported = false;
if (_inputStream != null) {
- _inputStream._onError(e);
+ reported = reported || _inputStream._onSocketError(e);
}
if (_outputStream != null) {
- _outputStream._onError(e);
+ reported = reported || _outputStream._onSocketError(e);
}
+ return reported;
}
void _updateOutHandler() {
« no previous file with comments | « runtime/bin/socket.dart ('k') | runtime/bin/socket_stream_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698