Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: sdk/lib/core/errors.dart

Issue 1318943005: Update range errors to agree on the numbers. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 int get start => 0; 389 int get start => 0;
390 int get end => length - 1; 390 int get end => length - 1;
391 391
392 String get _errorName => "RangeError"; 392 String get _errorName => "RangeError";
393 String get _errorExplanation { 393 String get _errorExplanation {
394 assert(_hasValue); 394 assert(_hasValue);
395 String target = Error.safeToString(indexable); 395 String target = Error.safeToString(indexable);
396 var explanation = ": index should be less than $length"; 396 var explanation = ": index should be less than $length";
397 if (invalidValue < 0) { 397 if (invalidValue < 0) {
398 explanation = ": index must not be negative"; 398 explanation = ": index must not be negative";
399 } else if (length == 0) {
400 explanation = ": list is empty";
floitsch 2015/09/08 10:54:19 I don't think we should make the assumption that t
Lasse Reichstein Nielsen 2015/09/08 11:38:03 Good point, reworded.
399 } 401 }
400 return explanation; 402 return explanation;
401 } 403 }
402 } 404 }
403 405
404 406
405 /** 407 /**
406 * Error thrown when control reaches the end of a switch case. 408 * Error thrown when control reaches the end of a switch case.
407 * 409 *
408 * The Dart specification requires this error to be thrown when 410 * The Dart specification requires this error to be thrown when
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 * the first time it is read. If evaluating the initializer expression causes 564 * the first time it is read. If evaluating the initializer expression causes
563 * another read of the variable, this error is thrown. 565 * another read of the variable, this error is thrown.
564 */ 566 */
565 class CyclicInitializationError extends Error { 567 class CyclicInitializationError extends Error {
566 final String variableName; 568 final String variableName;
567 CyclicInitializationError([this.variableName]); 569 CyclicInitializationError([this.variableName]);
568 String toString() => variableName == null 570 String toString() => variableName == null
569 ? "Reading static variable during its initialization" 571 ? "Reading static variable during its initialization"
570 : "Reading static variable '$variableName' during its initialization"; 572 : "Reading static variable '$variableName' during its initialization";
571 } 573 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698