OLD | NEW |
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:source_maps/source_maps.dart'; |
12 import 'package:stack_trace/stack_trace.dart'; | 12 import 'package:stack_trace/stack_trace.dart'; |
13 | 13 |
14 import '../lib/src/command.dart'; | 14 import '../lib/src/command.dart'; |
| 15 import '../lib/src/exceptions.dart'; |
15 import '../lib/src/exit_codes.dart' as exit_codes; | 16 import '../lib/src/exit_codes.dart' as exit_codes; |
16 import '../lib/src/http.dart'; | 17 import '../lib/src/http.dart'; |
17 import '../lib/src/io.dart'; | 18 import '../lib/src/io.dart'; |
18 import '../lib/src/log.dart' as log; | 19 import '../lib/src/log.dart' as log; |
19 import '../lib/src/sdk.dart' as sdk; | 20 import '../lib/src/sdk.dart' as sdk; |
20 import '../lib/src/utils.dart'; | 21 import '../lib/src/utils.dart'; |
21 | 22 |
22 void main(List<String> arguments) { | 23 void main(List<String> arguments) { |
23 ArgResults options; | 24 ArgResults options; |
24 | 25 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 log.json.error(error); | 103 log.json.error(error); |
103 } | 104 } |
104 } | 105 } |
105 | 106 |
106 if (options['trace'] || !isUserFacingException(error)) { | 107 if (options['trace'] || !isUserFacingException(error)) { |
107 log.error(chain.terse); | 108 log.error(chain.terse); |
108 } else { | 109 } else { |
109 log.fine(chain.terse); | 110 log.fine(chain.terse); |
110 } | 111 } |
111 | 112 |
112 if (error is ApplicationException && error.innerError != null) { | 113 if (error is WrappedException && error.innerError != null) { |
113 var message = "Wrapped exception: ${error.innerError}"; | 114 var message = "Wrapped exception: ${error.innerError}"; |
114 if (error.innerTrace != null) message = "$message\n${error.innerTrace}"; | 115 if (error.innerChain != null) message = "$message\n${error.innerChain}"; |
115 log.fine(message); | 116 log.fine(message); |
116 } | 117 } |
117 | 118 |
118 if (options['trace']) { | 119 if (options['trace']) { |
119 log.dumpTranscript(); | 120 log.dumpTranscript(); |
120 } else if (!isUserFacingException(error)) { | 121 } else if (!isUserFacingException(error)) { |
121 log.error(""" | 122 log.error(""" |
122 This is an unexpected error. Please run | 123 This is an unexpected error. Please run |
123 | 124 |
124 pub --trace ${arguments.map((arg) => "'$arg'").join(' ')} | 125 pub --trace ${arguments.map((arg) => "'$arg'").join(' ')} |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 if (Platform.operatingSystem != 'windows') return null; | 213 if (Platform.operatingSystem != 'windows') return null; |
213 | 214 |
214 return runProcess('ver', []).then((result) { | 215 return runProcess('ver', []).then((result) { |
215 if (result.stdout.join('\n').contains('XP')) { | 216 if (result.stdout.join('\n').contains('XP')) { |
216 log.error('Sorry, but pub is not supported on Windows XP.'); | 217 log.error('Sorry, but pub is not supported on Windows XP.'); |
217 return flushThenExit(exit_codes.USAGE); | 218 return flushThenExit(exit_codes.USAGE); |
218 } | 219 } |
219 }); | 220 }); |
220 }); | 221 }); |
221 } | 222 } |
OLD | NEW |