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 // The dart:io library is the concatenation of all the files in | 5 // The dart:io library is the concatenation of all the files in |
6 // io_sources.gypi. This file needs to be the first file in that | 6 // io_sources.gypi. This file needs to be the first file in that |
7 // concatenation. | 7 // concatenation. |
8 | 8 |
9 #library("io"); | 9 #library("io"); |
10 #import("dart:coreimpl"); | 10 #import("dart:coreimpl"); |
11 #import("dart:isolate"); | 11 #import("dart:isolate"); |
12 #import("dart:nativewrappers"); | 12 #import("dart:nativewrappers"); |
13 | |
14 /** 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.
| |
15 * operating system. | |
16 */ | |
17 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.
| |
18 static int noErrorCode = -1; | |
19 | |
20 OSError([String this.message, int this.errorCode = -1]); | |
21 | |
22 String toString() { | |
23 StringBuffer sb = new StringBuffer(); | |
24 sb.add("OS Error"); | |
25 if (message != null && message.length > 0) { | |
26 sb.add(": "); | |
27 sb.add(message); | |
28 if (errorCode != noErrorCode) { | |
29 sb.add(", errno = "); | |
30 sb.add(errorCode.toString()); | |
31 } | |
32 } else if (errorCode != noErrorCode) { | |
33 sb.add(": errno = "); | |
34 sb.add(errorCode.toString()); | |
35 } | |
36 return sb.toString(); | |
37 } | |
38 | |
39 /** 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.
| |
40 * associated with the error. | |
41 */ | |
42 String message; | |
43 | |
44 /** 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.
| |
45 * [noErrorCode] if there is no error code associated with the error. | |
46 */ | |
47 int errorCode; | |
48 } | |
OLD | NEW |