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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 7
8 /** 8 /**
9 * [InternetAddressType] is the type an [InternetAddress]. Currently, 9 * [InternetAddressType] is the type an [InternetAddress]. Currently,
10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. 10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported.
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 InternetAddress get address; 460 InternetAddress get address;
461 461
462 /** 462 /**
463 * Returns the remote host connected to by this socket. 463 * Returns the remote host connected to by this socket.
464 */ 464 */
465 String get remoteHost; 465 String get remoteHost;
466 } 466 }
467 467
468 468
469 class SocketException implements IOException { 469 class SocketException implements IOException {
470 const SocketException([String this.message = "", 470 final String message;
471 OSError this.osError = null]); 471 final OSError osError;
472 final InternetAddress address;
473 final int port;
474
475 const SocketException(String this.message,
476 {OSError this.osError,
477 InternetAddress this.address,
478 int this.port});
479
472 String toString() { 480 String toString() {
473 StringBuffer sb = new StringBuffer(); 481 StringBuffer sb = new StringBuffer();
474 sb.write("SocketException"); 482 sb.write("SocketException");
475 if (!message.isEmpty) { 483 if (!message.isEmpty) {
476 sb.write(": $message"); 484 sb.write(": $message");
477 if (osError != null) { 485 if (osError != null) {
478 sb.write(" ($osError)"); 486 sb.write(" ($osError)");
479 } 487 }
480 } else if (osError != null) { 488 } else if (osError != null) {
481 sb.write(": $osError"); 489 sb.write(": $osError");
482 } 490 }
491 if (address != null) {
492 if (address.host.isNotEmpty) {
493 sb.write(", address = ${address.host}");
494 } else {
495 sb.write(", address = ${address.address}");
496 }
497 }
498 if (port != null) {
499 sb.write(", port = $port");
500 }
483 return sb.toString(); 501 return sb.toString();
484 } 502 }
485 final String message;
486 final OSError osError;
487 } 503 }
OLDNEW
« 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