Chromium Code Reviews| Index: sdk/lib/_internal/pub/lib/src/exceptions.dart |
| diff --git a/sdk/lib/_internal/pub/lib/src/exceptions.dart b/sdk/lib/_internal/pub/lib/src/exceptions.dart |
| index af09a0c366d4271a61f47af0d941d55de2fa3a1d..1397457b473380fdd132ff7d53e3a73276b1a12b 100644 |
| --- a/sdk/lib/_internal/pub/lib/src/exceptions.dart |
| +++ b/sdk/lib/_internal/pub/lib/src/exceptions.dart |
| @@ -51,12 +51,20 @@ class SilentException extends WrappedException { |
| /// A class for command usage exceptions. |
| class UsageException extends ApplicationException { |
| /// The command usage information. |
| - final String usage; |
| + String _usage; |
| - UsageException(String message, this.usage) |
| + UsageException(String message) |
| : super(message); |
| - String toString() => "$message\n\n$usage"; |
| + String toString() => "$message\n\n$_usage"; |
|
nweiz
2014/07/02 00:12:02
Gracefully handle usage not being bound.
Bob Nystrom
2014/07/02 18:00:52
Done.
|
| + |
| + /// Attach usage information to the exception. |
| + /// |
| + /// This is done after the exception is created so that code outside of the |
| + /// command can still generate usage errors. |
| + void bindUsage(String usage) { |
| + _usage = usage; |
| + } |
| } |
| /// A class for errors in a command's input data. |