| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 explanation = ": Valid value range is empty"; | 91 explanation = ": Valid value range is empty"; |
| 92 } | 92 } |
| 93 else { | 93 else { |
| 94 explanation = ": Only valid value is $start"; | 94 explanation = ": Only valid value is $start"; |
| 95 } | 95 } |
| 96 return "RangeError: $message ($value)$explanation"; | 96 return "RangeError: $message ($value)$explanation"; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 class IndexError extends ArgumentError implements RangeError {final indexable; | 99 class IndexError extends ArgumentError implements RangeError {final indexable; |
| 100 final int length; | 100 final int length; |
| 101 IndexError(int invalidValue, indexable, [String name, String message, int lengt
h]) : this.indexable = indexable, this.length = (length != null) ? length : inde
xable.length, super.value(invalidValue, name, (message != null) ? message : "Ind
ex out of range"); | 101 IndexError(int invalidValue, indexable, [String name, String message, int lengt
h]) : this.indexable = indexable, this.length = ((__x3) => DDC$RT.cast(__x3, dyn
amic, int, "CastGeneral", """line 371, column 23 of dart:core/errors.dart: """,
__x3 is int, true))((length != null) ? length : indexable.length), super.value(i
nvalidValue, name, (message != null) ? message : "Index out of range"); |
| 102 int get start => 0; | 102 int get start => 0; |
| 103 int get end => length - 1; | 103 int get end => length - 1; |
| 104 String toString() { | 104 String toString() { |
| 105 assert (_hasValue); String target = Error.safeToString(indexable); | 105 assert (_hasValue); String target = Error.safeToString(indexable); |
| 106 var explanation = "index should be less than $length"; | 106 var explanation = "index should be less than $length"; |
| 107 if (invalidValue < 0) { | 107 if (invalidValue < 0) { |
| 108 explanation = "index must not be negative"; | 108 explanation = "index must not be negative"; |
| 109 } | 109 } |
| 110 return "RangeError: $message ($target[$invalidValue]): $explanation"; | 110 return "RangeError: $message ($target[$invalidValue]): $explanation"; |
| 111 } | 111 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 StackTrace get stackTrace => null; | 151 StackTrace get stackTrace => null; |
| 152 } | 152 } |
| 153 class StackOverflowError implements Error {const StackOverflowError(); | 153 class StackOverflowError implements Error {const StackOverflowError(); |
| 154 String toString() => "Stack Overflow"; | 154 String toString() => "Stack Overflow"; |
| 155 StackTrace get stackTrace => null; | 155 StackTrace get stackTrace => null; |
| 156 } | 156 } |
| 157 class CyclicInitializationError extends Error {final String variableName; | 157 class CyclicInitializationError extends Error {final String variableName; |
| 158 CyclicInitializationError([this.variableName]); | 158 CyclicInitializationError([this.variableName]); |
| 159 String toString() => variableName == null ? "Reading static variable during its
initialization" : "Reading static variable '$variableName' during its initializ
ation"; | 159 String toString() => variableName == null ? "Reading static variable during its
initialization" : "Reading static variable '$variableName' during its initializ
ation"; |
| 160 } | 160 } |
| OLD | NEW |