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

Unified Diff: lib/core/errors.dart

Issue 11365059: Temporarily reintroduce IndexOutOfRangeError matcher in unittests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed test expectations now that we are 100% backwards compatible. Created 8 years, 1 month 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 | « no previous file | pkg/unittest/lib/src/core_matchers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/core/errors.dart
diff --git a/lib/core/errors.dart b/lib/core/errors.dart
index c5164262b001829302b756feef6d9150f6e55322..ef4c135a460087f40287bff6daa3e7e4355d9562 100644
--- a/lib/core/errors.dart
+++ b/lib/core/errors.dart
@@ -27,11 +27,11 @@ class CastError implements Error {
/**
* Error thrown when a function is passed an unacceptable argument.
*/
- class ArgumentError implements Error {
+class ArgumentError implements Error {
final message;
/** The [message] describes the erroneous argument. */
- const ArgumentError([this.message = ""]);
+ const ArgumentError([this.message]);
String toString() {
if (message != null) {
@@ -44,13 +44,17 @@ class CastError implements Error {
/**
* Exception thrown because of an index outside of the valid range.
*
- * Temporarily extends [Exception] for backwards compatiblity.
+ * Temporarily implements [IndexOutOfRangeException] for backwards compatiblity.
*/
-class RangeError extends ArgumentError implements Exception {
+class RangeError extends ArgumentError implements IndexOutOfRangeException {
// TODO(lrn): This constructor should be called only with string values.
// It currently isn't in all cases.
- /** Create a new [RangeError] with the given [message]. */
- RangeError(var message) : super("$message");
+ /**
+ * Create a new [RangeError] with the given [message].
+ *
+ * Temporarily made const for backwards compatibilty.
+ */
+ const RangeError(var message) : super(message);
/** Create a new [RangeError] with a message for the given [value]. */
RangeError.value(num value) : super("value $value");
@@ -63,11 +67,10 @@ class RangeError extends ArgumentError implements Exception {
*
* This class allows code throwing the old [IndexOutOfRangeException] to
* work until they change to the new [RangeError] name.
- * Code **catching** IndexOutOfRangeException will fail to catch
- * the [RangeError] objects that are now thrown.
+ * Constructor of [RangeError] is const only to support this interface.
*/
-class IndexOutOfRangeException extends ArgumentError {
- IndexOutOfRangeException(var message) : super(message);
+interface IndexOutOfRangeException extends Exception default RangeError {
+ const IndexOutOfRangeException(var message);
}
« no previous file with comments | « no previous file | pkg/unittest/lib/src/core_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698