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 part of dart.core; | 5 part of dart.core; |
6 | 6 |
7 class Error { | 7 class Error { |
8 const Error(); | 8 const Error(); |
9 | 9 |
10 /** | 10 /** |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 "${Error.safeToString(modifiedObject)}."; | 222 "${Error.safeToString(modifiedObject)}."; |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 | 226 |
227 class OutOfMemoryError implements Error { | 227 class OutOfMemoryError implements Error { |
228 const OutOfMemoryError(); | 228 const OutOfMemoryError(); |
229 String toString() => "Out of Memory"; | 229 String toString() => "Out of Memory"; |
230 } | 230 } |
231 | 231 |
| 232 |
232 class StackOverflowError implements Error { | 233 class StackOverflowError implements Error { |
233 const StackOverflowError(); | 234 const StackOverflowError(); |
234 String toString() => "Stack Overflow"; | 235 String toString() => "Stack Overflow"; |
235 } | 236 } |
236 | 237 |
237 /** | 238 /** |
238 * Error thrown when a runtime error occurs. | 239 * Error thrown when a lazily initialized variable cannot be initialized. |
| 240 * |
| 241 * A static/library variable with an initializer expression is initialized |
| 242 * the first time it is read. If evaluating the initializer expression causes |
| 243 * another read of the variable, this error is thrown. |
239 */ | 244 */ |
240 class RuntimeError implements Error { | 245 class CyclicInitializationError implements Error { |
241 final message; | 246 final String variableName; |
242 RuntimeError(this.message); | 247 const CyclicInitializationError([this.variableName]); |
243 String toString() => "RuntimeError: $message"; | 248 String toString() => variableName == null |
| 249 ? "Reading static variable during its initialization" |
| 250 : "Reading static variable '$variableName' during its initialization"; |
244 } | 251 } |
OLD | NEW |