Index: sdk/lib/io/file.dart |
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart |
index d48a367005e572cd5daaf9959f83ff27c02e89ac..9bba4be19ca353e5bc6e62afbe673bdfb370dba4 100644 |
--- a/sdk/lib/io/file.dart |
+++ b/sdk/lib/io/file.dart |
@@ -561,10 +561,34 @@ abstract class RandomAccessFile { |
} |
+/** |
+ * Exception thrown when a file operation fails. |
+ */ |
class FileSystemException implements IOException { |
+ /** |
+ * Message describing the error. This does not include any detailed |
+ * information form the underlying OS error. Check [osError] for |
+ * that information. |
+ */ |
final String message; |
+ |
+ /** |
+ * The file system path on which the error occurred. Can be `null` |
+ * if the exception does not relate directly to a file system path. |
+ */ |
final String path; |
+ |
+ /** |
+ * The underlying OS error. Can be `null` if the exception is not |
+ * raised due to an OS error. |
+ */ |
final OSError osError; |
+ |
+ /** |
+ * Creates a new FileSystemException with an optional error message |
+ * [message], optional file system path [path] and optional OS error |
+ * [osError]. |
+ */ |
const FileSystemException([this.message = "", this.path = "", this.osError]); |
String toString() { |
@@ -573,16 +597,18 @@ class FileSystemException implements IOException { |
if (!message.isEmpty) { |
sb.write(": $message"); |
if (path != null) { |
- sb.write(", path = $path"); |
+ sb.write(", path = '$path'"); |
} |
if (osError != null) { |
sb.write(" ($osError)"); |
} |
} else if (osError != null) { |
- sb.write(": osError"); |
+ sb.write(": $osError"); |
if (path != null) { |
- sb.write(", path = $path"); |
+ sb.write(", path = '$path'"); |
} |
+ } else if (path != null) { |
+ sb.write(": $path"); |
} |
return sb.toString(); |
} |