| OLD | NEW |
| 1 part of dart.core; | 1 part of dart.core; |
| 2 class Error {Error(); | 2 class Error {Error(); |
| 3 static String safeToString(Object object) { | 3 static String safeToString(Object object) { |
| 4 if (object is num || object is bool || null == object) { | 4 if (object is num || object is bool || null == object) { |
| 5 return object.toString(); | 5 return object.toString(); |
| 6 } | 6 } |
| 7 if (object is String) { | 7 if (object is String) { |
| 8 return _stringToSafeString(object); | 8 return _stringToSafeString(object); |
| 9 } | 9 } |
| 10 return _objectToString(object); | 10 return _objectToString(object); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 explanation = ": Valid value range is empty"; | 90 explanation = ": Valid value range is empty"; |
| 91 } | 91 } |
| 92 else { | 92 else { |
| 93 explanation = ": Only valid value is $start"; | 93 explanation = ": Only valid value is $start"; |
| 94 } | 94 } |
| 95 return "RangeError: $message ($value)$explanation"; | 95 return "RangeError: $message ($value)$explanation"; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 class IndexError extends ArgumentError implements RangeError {final indexable; | 98 class IndexError extends ArgumentError implements RangeError {final indexable; |
| 99 final int length; | 99 final int length; |
| 100 IndexError(int invalidValue, indexable, [String name, String message, int lengt
h]) : this.indexable = indexable, this.length = ((__x3) => DEVC$RT.cast(__x3, dy
namic, int, "DynamicCast", """line 371, column 23 of dart:core/errors.dart: """,
__x3 is int, true))((length != null) ? length : indexable.length), super.value(
invalidValue, name, (message != null) ? message : "Index out of range"); | 100 IndexError(int invalidValue, indexable, [String name, String message, int lengt
h]) : this.indexable = indexable, this.length = (length != null) ? length : DEVC
$RT.cast(indexable.length, dynamic, int, "DynamicCast", """line 371, column 51 o
f dart:core/errors.dart: """, indexable.length is int, true), super.value(invali
dValue, name, (message != null) ? message : "Index out of range"); |
| 101 int get start => 0; | 101 int get start => 0; |
| 102 int get end => length - 1; | 102 int get end => length - 1; |
| 103 String toString() { | 103 String toString() { |
| 104 assert (_hasValue); String target = Error.safeToString(indexable); | 104 assert (_hasValue); String target = Error.safeToString(indexable); |
| 105 var explanation = "index should be less than $length"; | 105 var explanation = "index should be less than $length"; |
| 106 if (invalidValue < 0) { | 106 if (invalidValue < 0) { |
| 107 explanation = "index must not be negative"; | 107 explanation = "index must not be negative"; |
| 108 } | 108 } |
| 109 return "RangeError: $message ($target[$invalidValue]): $explanation"; | 109 return "RangeError: $message ($target[$invalidValue]): $explanation"; |
| 110 } | 110 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 StackTrace get stackTrace => null; | 149 StackTrace get stackTrace => null; |
| 150 } | 150 } |
| 151 class StackOverflowError implements Error {const StackOverflowError(); | 151 class StackOverflowError implements Error {const StackOverflowError(); |
| 152 String toString() => "Stack Overflow"; | 152 String toString() => "Stack Overflow"; |
| 153 StackTrace get stackTrace => null; | 153 StackTrace get stackTrace => null; |
| 154 } | 154 } |
| 155 class CyclicInitializationError extends Error {final String variableName; | 155 class CyclicInitializationError extends Error {final String variableName; |
| 156 CyclicInitializationError([this.variableName]); | 156 CyclicInitializationError([this.variableName]); |
| 157 String toString() => variableName == null ? "Reading static variable during its
initialization" : "Reading static variable '$variableName' during its initializ
ation"; | 157 String toString() => variableName == null ? "Reading static variable during its
initialization" : "Reading static variable '$variableName' during its initializ
ation"; |
| 158 } | 158 } |
| OLD | NEW |