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; |
+} |