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: sdk/lib/_internal/pub/bin/pub.dart

Issue 351703004: Improve pub's pubspec error messages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/barback/transformer_config.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:io'; 6 import 'dart:io';
7 7
8 import 'package:args/args.dart'; 8 import 'package:args/args.dart';
9 import 'package:http/http.dart' as http; 9 import 'package:http/http.dart' as http;
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
11 import 'package:source_maps/source_maps.dart';
11 import 'package:stack_trace/stack_trace.dart'; 12 import 'package:stack_trace/stack_trace.dart';
12 13
13 import '../lib/src/command.dart'; 14 import '../lib/src/command.dart';
14 import '../lib/src/exit_codes.dart' as exit_codes; 15 import '../lib/src/exit_codes.dart' as exit_codes;
15 import '../lib/src/http.dart'; 16 import '../lib/src/http.dart';
16 import '../lib/src/io.dart'; 17 import '../lib/src/io.dart';
17 import '../lib/src/log.dart' as log; 18 import '../lib/src/log.dart' as log;
18 import '../lib/src/sdk.dart' as sdk; 19 import '../lib/src/sdk.dart' as sdk;
19 import '../lib/src/utils.dart'; 20 import '../lib/src/utils.dart';
20 21
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void runPub(String cacheDir, ArgResults options, List<String> arguments) { 80 void runPub(String cacheDir, ArgResults options, List<String> arguments) {
80 var captureStackChains = 81 var captureStackChains =
81 options['trace'] || 82 options['trace'] ||
82 options['verbose'] || 83 options['verbose'] ||
83 options['verbosity'] == 'all'; 84 options['verbosity'] == 'all';
84 85
85 captureErrors(() => invokeCommand(cacheDir, options), 86 captureErrors(() => invokeCommand(cacheDir, options),
86 captureStackChains: captureStackChains).catchError((error, Chain chain) { 87 captureStackChains: captureStackChains).catchError((error, Chain chain) {
87 // This is basically the top-level exception handler so that we don't 88 // This is basically the top-level exception handler so that we don't
88 // spew a stack trace on our users. 89 // spew a stack trace on our users.
89 var message = getErrorMessage(error); 90 if (error is SpanException) {
90 log.error(message); 91 log.error(error.toString(useColors: canUseSpecialChars));
92 } else {
93 log.error(getErrorMessage(error));
94 }
91 log.fine("Exception type: ${error.runtimeType}"); 95 log.fine("Exception type: ${error.runtimeType}");
92 96
93 if (log.json.enabled) { 97 if (log.json.enabled) {
94 if (error is UsageException) { 98 if (error is UsageException) {
95 // Don't print usage info in JSON output. 99 // Don't print usage info in JSON output.
96 log.json.error(error.message); 100 log.json.error(error.message);
97 } else { 101 } else {
98 log.json.error(error); 102 log.json.error(error);
99 } 103 }
100 } 104 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (Platform.operatingSystem != 'windows') return null; 212 if (Platform.operatingSystem != 'windows') return null;
209 213
210 return runProcess('ver', []).then((result) { 214 return runProcess('ver', []).then((result) {
211 if (result.stdout.join('\n').contains('XP')) { 215 if (result.stdout.join('\n').contains('XP')) {
212 log.error('Sorry, but pub is not supported on Windows XP.'); 216 log.error('Sorry, but pub is not supported on Windows XP.');
213 return flushThenExit(exit_codes.USAGE); 217 return flushThenExit(exit_codes.USAGE);
214 } 218 }
215 }); 219 });
216 }); 220 });
217 } 221 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/barback/transformer_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698