| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * The main entrypoint for the pub command line application. | 6 * The main entrypoint for the pub command line application. |
| 7 */ | 7 */ |
| 8 #library('pub'); | 8 #library('pub'); |
| 9 | 9 |
| 10 #import('../../pkg/args/args.dart'); | 10 #import('../../pkg/args/args.dart'); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 try { | 177 try { |
| 178 commandOptions = commandParser.parse(commandArgs); | 178 commandOptions = commandParser.parse(commandArgs); |
| 179 } on FormatException catch (e) { | 179 } on FormatException catch (e) { |
| 180 this.printUsage(description: e.message); | 180 this.printUsage(description: e.message); |
| 181 return; | 181 return; |
| 182 } | 182 } |
| 183 | 183 |
| 184 handleError(error, trace) { | 184 handleError(error, trace) { |
| 185 // This is basically the top-level exception handler so that we don't | 185 // This is basically the top-level exception handler so that we don't |
| 186 // spew a stack trace on our users. | 186 // spew a stack trace on our users. |
| 187 // TODO(rnystrom): Add --trace flag so stack traces can be enabled for | |
| 188 // debugging. | |
| 189 var message = error.toString(); | 187 var message = error.toString(); |
| 190 | 188 |
| 191 // TODO(rnystrom): The default exception implementation class puts | 189 // TODO(rnystrom): The default exception implementation class puts |
| 192 // "Exception:" in the output, so strip that off. | 190 // "Exception:" in the output, so strip that off. |
| 193 if (message.startsWith("Exception: ")) { | 191 if (message.startsWith("Exception: ")) { |
| 194 message = message.substring("Exception: ".length); | 192 message = message.substring("Exception: ".length); |
| 195 } | 193 } |
| 196 | 194 |
| 197 printError(message); | 195 printError(message); |
| 198 if (globalOptions['trace'] && trace != null) { | 196 if (globalOptions['trace'] && trace != null) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 print(''); | 232 print(''); |
| 235 print('Usage: $usage'); | 233 print('Usage: $usage'); |
| 236 | 234 |
| 237 var commandUsage = commandParser.getUsage(); | 235 var commandUsage = commandParser.getUsage(); |
| 238 if (!commandUsage.isEmpty()) { | 236 if (!commandUsage.isEmpty()) { |
| 239 print(''); | 237 print(''); |
| 240 print(commandUsage); | 238 print(commandUsage); |
| 241 } | 239 } |
| 242 } | 240 } |
| 243 } | 241 } |
| OLD | NEW |