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

Unified Diff: sdk/lib/_internal/pub/lib/src/exceptions.dart

Issue 354763006: Add a "pub global run" command. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise! Created 6 years, 6 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
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/entrypoint.dart ('k') | sdk/lib/_internal/pub/lib/src/executable.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..76c62390c497ee9269e4928410865be173c57152 100644
--- a/sdk/lib/_internal/pub/lib/src/exceptions.dart
+++ b/sdk/lib/_internal/pub/lib/src/exceptions.dart
@@ -51,12 +51,23 @@ 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() {
+ if (_usage == null) return message;
+ return "$message\n\n$_usage";
+ }
+
+ /// 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.
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/entrypoint.dart ('k') | sdk/lib/_internal/pub/lib/src/executable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698