Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 } |
|
Bill Hesse
2013/07/05 12:26:35
Of course, we are now missing ": " if both message
Anders Johnsen
2013/07/05 12:36:01
Nope.
| |
| 491 if (address != null) { | |
| 492 sb.write(", address = ${address.address}"); | |
| 493 } | |
| 494 if (port != null) { | |
| 495 sb.write(", port = $port"); | |
| 496 } | |
| 483 return sb.toString(); | 497 return sb.toString(); |
| 484 } | 498 } |
| 485 final String message; | |
| 486 final OSError osError; | |
| 487 } | 499 } |
| OLD | NEW |