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(); |
} |