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 /** | 7 /** |
8 * Error objects thrown in the case of a program failure. | 8 * Error objects thrown in the case of a program failure. |
9 * | 9 * |
10 * An `Error` object represents a program failure that the programmer | 10 * An `Error` object represents a program failure that the programmer |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 /** | 311 /** |
312 * Creates a new [IndexError] stating that [invalidValue] is not a valid index | 312 * Creates a new [IndexError] stating that [invalidValue] is not a valid index |
313 * into [indexable]. | 313 * into [indexable]. |
314 * | 314 * |
315 * The [length] is the length of [indexable] at the time of the error. | 315 * The [length] is the length of [indexable] at the time of the error. |
316 * If `length` is omitted, it defaults to `indexable.length`. | 316 * If `length` is omitted, it defaults to `indexable.length`. |
317 * | 317 * |
318 * The message is used as part of the string representation of the error. | 318 * The message is used as part of the string representation of the error. |
319 */ | 319 */ |
320 IndexError(indexable, this.invalidValue, | 320 IndexError(this.invalidValue, indexable, |
321 [String message = "Index out of range", int length]) | 321 [String message = "Index out of range", int length]) |
322 : this.indexable = indexable, | 322 : this.indexable = indexable, |
323 this.length = (length != null) ? length : indexable.length, | 323 this.length = (length != null) ? length : indexable.length, |
324 super(message); | 324 super(message); |
325 | 325 |
326 // Getters inherited from RangeError. | 326 // Getters inherited from RangeError. |
327 int get start => 0; | 327 int get start => 0; |
328 int get end => length - 1; | 328 int get end => length - 1; |
329 | 329 |
330 String toString() { | 330 String toString() { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 * the first time it is read. If evaluating the initializer expression causes | 499 * the first time it is read. If evaluating the initializer expression causes |
500 * another read of the variable, this error is thrown. | 500 * another read of the variable, this error is thrown. |
501 */ | 501 */ |
502 class CyclicInitializationError extends Error { | 502 class CyclicInitializationError extends Error { |
503 final String variableName; | 503 final String variableName; |
504 CyclicInitializationError([this.variableName]); | 504 CyclicInitializationError([this.variableName]); |
505 String toString() => variableName == null | 505 String toString() => variableName == null |
506 ? "Reading static variable during its initialization" | 506 ? "Reading static variable during its initialization" |
507 : "Reading static variable '$variableName' during its initialization"; | 507 : "Reading static variable '$variableName' during its initialization"; |
508 } | 508 } |
OLD | NEW |