26f0de69b0
method workaround. R=sgjesse@google.com BUG= TEST= Review URL: https://chromiumcodereview.appspot.com//10443029 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7994 260f80e4-7a28-3924-810f-c04153c831b5
43 lines
1.2 KiB
Dart
43 lines
1.2 KiB
Dart
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
/**
|
|
* An [OSError] object holds information about an error from the
|
|
* operating system.
|
|
*/
|
|
class OSError {
|
|
static final int noErrorCode = -1;
|
|
|
|
const OSError([String this.message = "", int this.errorCode = noErrorCode]);
|
|
|
|
String toString() {
|
|
StringBuffer sb = new StringBuffer();
|
|
sb.add("OS Error");
|
|
if (!message.isEmpty()) {
|
|
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
|
|
* associated with the error.
|
|
*/
|
|
final String message;
|
|
|
|
/**
|
|
* Error code supplied by the operating system. Will have the value
|
|
* [noErrorCode] if there is no error code associated with the error.
|
|
*/
|
|
final int errorCode;
|
|
}
|