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

Side by Side Diff: utils/pub/pub.dart

Issue 10917053: Show nicer errors on some server failures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 try { 170 try {
171 commandOptions = commandParser.parse(commandArgs); 171 commandOptions = commandParser.parse(commandArgs);
172 } on FormatException catch (e) { 172 } on FormatException catch (e) {
173 this.printUsage(description: e.message); 173 this.printUsage(description: e.message);
174 return; 174 return;
175 } 175 }
176 176
177 handleError(error, trace) { 177 handleError(error, trace) {
178 // This is basically the top-level exception handler so that we don't 178 // This is basically the top-level exception handler so that we don't
179 // spew a stack trace on our users. 179 // spew a stack trace on our users.
180 // TODO(rnystrom): Add --trace flag so stack traces can be enabled for
181 // debugging.
182 var message = error.toString(); 180 var message = error.toString();
183 181
184 // TODO(rnystrom): The default exception implementation class puts 182 // TODO(rnystrom): The default exception implementation class puts
185 // "Exception:" in the output, so strip that off. 183 // "Exception:" in the output, so strip that off.
186 if (message.startsWith("Exception: ")) { 184 if (message.startsWith("Exception: ")) {
187 message = message.substring("Exception: ".length); 185 message = message.substring("Exception: ".length);
188 } 186 }
189 187
190 printError(message); 188 printError(message);
191 if (globalOptions['trace'] && trace != null) { 189 if (globalOptions['trace'] && trace != null) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 print(''); 225 print('');
228 print('Usage: $usage'); 226 print('Usage: $usage');
229 227
230 var commandUsage = commandParser.getUsage(); 228 var commandUsage = commandParser.getUsage();
231 if (!commandUsage.isEmpty()) { 229 if (!commandUsage.isEmpty()) {
232 print(''); 230 print('');
233 print(commandUsage); 231 print(commandUsage);
234 } 232 }
235 } 233 }
236 } 234 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698