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

Unified Diff: runtime/lib/arrays.dart

Issue 10786045: Improve the error messages for IndexOutOfRangeException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « corelib/src/exceptions.dart ('k') | runtime/lib/byte_array.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/arrays.dart
diff --git a/runtime/lib/arrays.dart b/runtime/lib/arrays.dart
index 012a9e82a1b72962884a09e63000d0b6ca059130..6cf0402accd0fe37c1a47a4b9a453cde9031db1e 100644
--- a/runtime/lib/arrays.dart
+++ b/runtime/lib/arrays.dart
@@ -81,10 +81,12 @@ class Arrays {
throw new IllegalArgumentException("negative length $length");
}
if (start < 0 || start >= a.length) {
- throw new IndexOutOfRangeException(start);
+ String message = "$start must be in the range [0..${a.length})";
+ throw new IndexOutOfRangeException(message);
}
if (start + length > a.length) {
- throw new IndexOutOfRangeException(start + length);
+ String message = "$start + $length must be in the range [0..${a.length})";
+ throw new IndexOutOfRangeException(message);
}
}
}
« no previous file with comments | « corelib/src/exceptions.dart ('k') | runtime/lib/byte_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698