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

Unified Diff: pkg/args/lib/args.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: pkg/args/lib/args.dart
diff --git a/pkg/args/lib/args.dart b/pkg/args/lib/args.dart
index 7c51a08773c72e2a40b623343755b3020e99a321..52e7350d7f73771d3bec36e8c760ddda944ece19 100644
--- a/pkg/args/lib/args.dart
+++ b/pkg/args/lib/args.dart
@@ -220,7 +220,7 @@ class ArgParser {
_optionNames = <String>[];
/**
- * Defines a flag. Throws an [IllegalArgumentException] if:
+ * Defines a flag. Throws an [ArgumentError] if:
*
* * There is already an option named [name].
* * There is already an option using abbreviation [abbr].
@@ -232,7 +232,7 @@ class ArgParser {
}
/**
- * Defines a value-taking option. Throws an [IllegalArgumentException] if:
+ * Defines a value-taking option. Throws an [ArgumentError] if:
*
* * There is already an option with name [name].
* * There is already an option using abbreviation [abbr].
@@ -250,19 +250,19 @@ class ArgParser {
bool allowMultiple = false]) {
// Make sure the name isn't in use.
if (_options.containsKey(name)) {
- throw new IllegalArgumentException('Duplicate option "$name".');
+ throw new ArgumentError('Duplicate option "$name".');
}
// Make sure the abbreviation isn't too long or in use.
if (abbr != null) {
if (abbr.length > 1) {
- throw new IllegalArgumentException(
+ throw new ArgumentError(
'Abbreviation "$abbr" is longer than one character.');
}
var existing = _findByAbbr(abbr);
if (existing != null) {
- throw new IllegalArgumentException(
+ throw new ArgumentError(
'Abbreviation "$abbr" is already used by "${existing.name}".');
}
}
@@ -504,7 +504,7 @@ class ArgParser {
*/
getDefault(String option) {
if (!_options.containsKey(option)) {
- throw new IllegalArgumentException('No option named $option');
+ throw new ArgumentError('No option named $option');
}
return _options[option].defaultValue;
}
@@ -531,7 +531,7 @@ class ArgResults {
/** Gets the parsed command-line option named [name]. */
operator [](String name) {
if (!_options.containsKey(name)) {
- throw new IllegalArgumentException(
+ throw new ArgumentError(
'Could not find an option named "$name".');
}

Powered by Google App Engine
This is Rietveld 408576698