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

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

Issue 18154005: Add 'address' and 'port' to SocketException, and include them in toString(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/socket.dart
diff --git a/sdk/lib/io/socket.dart b/sdk/lib/io/socket.dart
index 1f1211a49d24ce05bc1cadd8b4a18226be1380c5..957440e435bfe925727dcbe956cded8c04d6fc6a 100644
--- a/sdk/lib/io/socket.dart
+++ b/sdk/lib/io/socket.dart
@@ -467,8 +467,16 @@ abstract class Socket implements Stream<List<int>>, IOSink {
class SocketException implements IOException {
- const SocketException([String this.message = "",
- OSError this.osError = null]);
+ final String message;
+ final OSError osError;
+ final InternetAddress address;
+ final int port;
+
+ const SocketException(String this.message,
+ {OSError this.osError,
+ InternetAddress this.address,
+ int this.port});
+
String toString() {
StringBuffer sb = new StringBuffer();
sb.write("SocketException");
@@ -480,8 +488,16 @@ class SocketException implements IOException {
} else if (osError != null) {
sb.write(": $osError");
}
+ if (address != null) {
+ if (address.host.isNotEmpty) {
+ sb.write(", address = ${address.host}");
+ } else {
+ sb.write(", address = ${address.address}");
+ }
+ }
+ if (port != null) {
+ sb.write(", port = $port");
+ }
return sb.toString();
}
- final String message;
- final OSError osError;
}
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698