Chromium Code Reviews| 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 class Error { | 5 class Error { |
| 6 const Error(); | 6 const Error(); |
| 7 } | 7 } |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Error thrown by the runtime system when an assert statement fails. | 10 * Error thrown by the runtime system when an assert statement fails. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 * | 202 * |
| 203 * This [Error] is thrown when a class cannot implement | 203 * This [Error] is thrown when a class cannot implement |
| 204 * one of the methods in its signature. | 204 * one of the methods in its signature. |
| 205 */ | 205 */ |
| 206 class UnsupportedError implements Error { | 206 class UnsupportedError implements Error { |
| 207 final String message; | 207 final String message; |
| 208 UnsupportedError(this.message); | 208 UnsupportedError(this.message); |
| 209 String toString() => "Unsupported operation: $message"; | 209 String toString() => "Unsupported operation: $message"; |
| 210 } | 210 } |
| 211 | 211 |
| 212 | |
| 213 /** | |
| 214 * Thrown by operations that have not yet been implemented. | |
|
floitsch
2012/11/02 12:25:12
have not been implemented yet ?
Lasse Reichstein Nielsen
2012/11/02 12:35:38
Done.
| |
| 215 * | |
| 216 * This [Error] is thrown by unfinished code that hasn't yet implemented | |
| 217 * all the features it needs. | |
|
floitsch
2012/11/02 12:25:12
If you intend to have a line-break in the output,
Lasse Reichstein Nielsen
2012/11/02 12:35:38
Done.
| |
| 218 * If a class is not intending to implement the feature, it should throw | |
| 219 * an [UnsupportedError] instead. This error is only intended for | |
| 220 * use during development. | |
| 221 * | |
| 222 * This class temporarily implements [Exception] for backwards compatibility. | |
| 223 * The constructor is temporarily const to support [NotImplementedException]. | |
| 224 */ | |
| 225 class UnimplementedError implements UnsupportedError, NotImplementedException { | |
| 226 final String message; | |
| 227 const UnimplementedError([String this.message]); | |
| 228 String toString() => (this.message !== null | |
| 229 ? "UnimplementedError: $message" | |
| 230 : "UnimplementedError"); | |
| 231 } | |
| 232 | |
| 233 | |
| 234 /** Temporary class added for backwards compatibility. Will be removed. */ | |
| 235 interface NotImplementedException extends Exception default UnimplementedError { | |
| 236 const NotImplementedException([String message]); | |
| 237 } | |
| 238 | |
| 239 | |
| 212 /** | 240 /** |
| 213 * The operation was not allowed by the current state of the object. | 241 * The operation was not allowed by the current state of the object. |
| 214 * | 242 * |
| 215 * This is a generic error used for a variety of different erroneous | 243 * This is a generic error used for a variety of different erroneous |
| 216 * actions. The message should be descriptive. | 244 * actions. The message should be descriptive. |
| 217 */ | 245 */ |
| 218 class StateError implements Error { | 246 class StateError implements Error { |
| 219 final String message; | 247 final String message; |
| 220 StateError(this.message); | 248 StateError(this.message); |
| 221 String toString() => "Bad state: $message"; | 249 String toString() => "Bad state: $message"; |
| 222 } | 250 } |
| 223 | 251 |
| 224 | 252 |
| 225 class OutOfMemoryError implements Error { | 253 class OutOfMemoryError implements Error { |
| 226 const OutOfMemoryError(); | 254 const OutOfMemoryError(); |
| 227 String toString() => "Out of Memory"; | 255 String toString() => "Out of Memory"; |
| 228 } | 256 } |
| 229 | 257 |
| 230 class StackOverflowError implements Error { | 258 class StackOverflowError implements Error { |
| 231 const StackOverflowError(); | 259 const StackOverflowError(); |
| 232 String toString() => "Stack Overflow"; | 260 String toString() => "Stack Overflow"; |
| 233 } | 261 } |
| OLD | NEW |