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

Unified Diff: runtime/bin/socket.dart

Issue 9699017: Start better error reporting for sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added tests Created 8 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
Index: runtime/bin/socket.dart
diff --git a/runtime/bin/socket.dart b/runtime/bin/socket.dart
index ad48172bf596e8a03ec49c1e9a1a77480b198405..219a7aa1c55b0363d0e1a977f8582db121012b5f 100644
--- a/runtime/bin/socket.dart
+++ b/runtime/bin/socket.dart
@@ -18,7 +18,7 @@ interface ServerSocket default _ServerSocket {
/**
* The error handler gets called when a socket error occurs.
*/
- void set onError(void callback());
+ void set onError(void callback(Exception e));
/**
* Returns the port used by this socket.
@@ -88,7 +88,7 @@ interface Socket extends Hashable default _Socket {
/**
* The error handler gets called when a socket error occurs.
*/
- void set onError(void callback());
+ void set onError(void callback(Exception e));
/**
* Returns input stream to the socket.
@@ -122,7 +122,21 @@ interface Socket extends Hashable default _Socket {
class SocketIOException implements Exception {
- const SocketIOException([String this.message = ""]);
- String toString() => "SocketIOException: $message";
+ const SocketIOException([String this.message = "",
+ OSError this.osError = null]);
+ String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.add("SocketIOException");
+ if (!message.isEmpty()) {
+ sb.add(": $message");
+ if (osError != null) {
+ sb.add(" ($osError)");
+ }
+ } else if (osError != null) {
+ sb.add(": osError");
+ }
+ return sb.toString();
+ }
final String message;
+ final OSError osError;
}

Powered by Google App Engine
This is Rietveld 408576698