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

Unified Diff: runtime/bin/io.dart

Issue 9630012: Error reporting on File in dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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
Index: runtime/bin/io.dart
diff --git a/runtime/bin/io.dart b/runtime/bin/io.dart
index 5908e2d0976bd3ee73b55619e4509e263ea1267d..9df9f552530125fc69079b2342e10db8a64ae29e 100644
--- a/runtime/bin/io.dart
+++ b/runtime/bin/io.dart
@@ -10,3 +10,39 @@
#import("dart:coreimpl");
#import("dart:isolate");
#import("dart:nativewrappers");
+
+/** Class for holding information on an error that was returned from the
Mads Ager (google) 2012/03/08 15:04:27 /** * Class
Søren Gjesse 2012/03/08 22:50:53 Done.
+ * operating system.
+ */
+class OSError {
Mads Ager (google) 2012/03/08 15:04:27 We should move this to a separate file instead of
Søren Gjesse 2012/03/08 22:50:53 Moved to common.dart.
+ static int noErrorCode = -1;
+
+ OSError([String this.message, int this.errorCode = -1]);
+
+ String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.add("OS Error");
+ if (message != null && message.length > 0) {
+ sb.add(": ");
+ sb.add(message);
+ if (errorCode != noErrorCode) {
+ sb.add(", errno = ");
+ sb.add(errorCode.toString());
+ }
+ } else if (errorCode != noErrorCode) {
+ sb.add(": errno = ");
+ sb.add(errorCode.toString());
+ }
+ return sb.toString();
+ }
+
+ /** Error message supplied by the operating system. null if no message is
Mads Ager (google) 2012/03/08 15:04:27 Ditto.
Søren Gjesse 2012/03/08 22:50:53 Done.
+ * associated with the error.
+ */
+ String message;
+
+ /** Error code supplied by the operating system. Will have the value
Mads Ager (google) 2012/03/08 15:04:27 Ditto.
Søren Gjesse 2012/03/08 22:50:53 Done.
+ * [noErrorCode] if there is no error code associated with the error.
+ */
+ int errorCode;
+}

Powered by Google App Engine
This is Rietveld 408576698