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

Unified Diff: lib/core/errors.dart

Issue 10989013: Change IllegalArgumentException to ArgumentError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated co19 test expectations. Created 8 years, 3 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
Index: lib/core/errors.dart
diff --git a/lib/core/errors.dart b/lib/core/errors.dart
index 659810714f30d829a97fc67b27794ca590067029..ee50f8a6aed714cb34724612d65d4a2dfe0d310d 100644
--- a/lib/core/errors.dart
+++ b/lib/core/errors.dart
@@ -16,6 +16,28 @@ class TypeError implements AssertionError {
class CastException implements Error {
}
+/**
+ * Error thrown when a function is passed an unacceptable argument.
+ */
+class ArgumentError implements Error {
+ final message;
+
+ /** The [message] describes the erroneous argument. */
+ const ArgumentError([this.message = ""]);
+
+ String toString() => "Illegal argument(s): $message";
Søren Gjesse 2012/09/25 12:22:24 Shouldn't the toString result be without the ": "
Lasse Reichstein Nielsen 2012/09/25 12:28:07 It should, yes.
+}
+
+/**
+ * Temporary backwards compatibility class.
+ *
+ * Removed when users have had time to change to using [ArgumentError].
+ */
+class IllegalArgumentException extends ArgumentError {
+ const IllegalArgumentException([argument = ""]) : super(argument);
+}
+
+
class FallThroughError implements Error {
const FallThroughError();
}

Powered by Google App Engine
This is Rietveld 408576698