| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 5 |
| 6 /** | 6 /** |
| 7 * FileMode describes the modes in which a file can be opened. | 7 * FileMode describes the modes in which a file can be opened. |
| 8 */ | 8 */ |
| 9 class FileMode { | 9 class FileMode { |
| 10 static final READ = const FileMode(0); | 10 static final READ = const FileMode(0); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 /** | 359 /** |
| 360 * Sets the handler that gets called when errors occur when | 360 * Sets the handler that gets called when errors occur when |
| 361 * operating on this file. | 361 * operating on this file. |
| 362 */ | 362 */ |
| 363 void set onError(void handler(String error)); | 363 void set onError(void handler(String error)); |
| 364 } | 364 } |
| 365 | 365 |
| 366 | 366 |
| 367 class FileIOException implements Exception { | 367 class FileIOException implements Exception { |
| 368 const FileIOException([String this.message = ""]); | 368 const FileIOException([String this.message = "", |
| 369 String toString() => "FileIOException: $message"; | 369 OSError this.osError = null]); |
| 370 String toString() { |
| 371 StringBuffer sb = new StringBuffer(); |
| 372 sb.add("FileIOException"); |
| 373 if (message != null) { |
| 374 sb.add(": $message"); |
| 375 if (osError != null) { |
| 376 sb.add(" (${osError.toString()})"); |
| 377 } |
| 378 } else if (osError != null) { |
| 379 sb.add(": ${osError.toString()}"); |
| 380 } |
| 381 return sb.toString(); |
| 382 } |
| 370 final String message; | 383 final String message; |
| 384 final OSError osError; |
| 371 } | 385 } |
| OLD | NEW |