Index: sdk/lib/core/errors.dart |
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart |
index 59f30d039198f5e711bdeaaea11d486aa1ce8067..92f313f0717d5ea70bb49ba94ed18ada9b329311 100644 |
--- a/sdk/lib/core/errors.dart |
+++ b/sdk/lib/core/errors.dart |
@@ -93,6 +93,10 @@ class RangeError extends ArgumentError { |
/** Create a new [RangeError] with a message for the given [value]. */ |
RangeError.value(num value) : super("value $value"); |
+ /** Create a new [RangeError] with a message for a value and a range. */ |
+ RangeError.range(num value, num start, num end) |
+ : super("value $value not in range $start..$end"); |
+ |
String toString() => "RangeError: $message"; |
} |
@@ -238,6 +242,29 @@ class StateError implements Error { |
} |
+/** |
+ * Error occurring when a collection is modified during iteration. |
+ * |
+ * Some modifications may be allowed for some collections, so each collection |
+ * ([Iterable] or similar collection of values) should declare which operations |
+ * are allowed during an iteration. |
+ */ |
+class ConcurrentModificationError implements Error { |
+ /** The object that was modified in an incompatible way. */ |
+ final Object modifiedObject; |
+ |
+ const ConcurrentModificationError([this.modifiedObject]); |
+ |
+ String toString() { |
+ if (modifiedObject == null) { |
+ return "Concurrent modification during iteration."; |
+ } |
+ return "Concurrent modification during iteration: " |
+ "${Error.safeToString(modifiedObject)}."; |
+ } |
+} |
+ |
+ |
class OutOfMemoryError implements Error { |
const OutOfMemoryError(); |
String toString() => "Out of Memory"; |