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

Unified Diff: runtime/lib/growable_array.dart

Issue 262803003: Unify error messages for iterables and lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Capitalize messages. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/array.dart ('k') | sdk/lib/collection/iterable.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/growable_array.dart
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index e9c10822432e6645cd313e0c37c30dc0b6bfb85c..ed5551a9d1296aadd442a3c0281affcb6fe5a433 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -198,18 +198,18 @@ class _GrowableList<T> implements List<T> {
T get first {
if (length > 0) return this[0];
- throw new StateError("No elements");
+ throw IterableElementError.noElement();
}
T get last {
if (length > 0) return this[length - 1];
- throw new StateError("No elements");
+ throw IterableElementError.noElement();
}
T get single {
if (length == 1) return this[0];
- if (length == 0) throw new StateError("No elements");
- throw new StateError("More than one element");
+ if (length == 0) throw IterableElementError.noElement();
+ throw IterableElementError.tooMany();;
}
int indexOf(Object element, [int start = 0]) {
« no previous file with comments | « runtime/lib/array.dart ('k') | sdk/lib/collection/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698