| 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 /// The main entrypoint for the pub command line application. | 5 /// The main entrypoint for the pub command line application. |
| 6 library pub; | 6 library pub; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:math'; | 10 import 'dart:math'; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // So just try it. If it throws, default to toString(). | 251 // So just try it. If it throws, default to toString(). |
| 252 message = error.message; | 252 message = error.message; |
| 253 } on NoSuchMethodError catch (_) { | 253 } on NoSuchMethodError catch (_) { |
| 254 message = error.toString(); | 254 message = error.toString(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 log.error(message); | 257 log.error(message); |
| 258 if (globalOptions['trace'] && trace != null) { | 258 if (globalOptions['trace'] && trace != null) { |
| 259 log.error(trace); | 259 log.error(trace); |
| 260 log.dumpTranscript(); | 260 log.dumpTranscript(); |
| 261 } else { |
| 262 log.fine(trace); |
| 261 } | 263 } |
| 262 | 264 |
| 263 exit(_chooseExitCode(error)); | 265 exit(_chooseExitCode(error)); |
| 264 } | 266 } |
| 265 | 267 |
| 266 defer(() { | 268 defer(() { |
| 267 if (requiresEntrypoint) { | 269 if (requiresEntrypoint) { |
| 268 // TODO(rnystrom): Will eventually need better logic to walk up | 270 // TODO(rnystrom): Will eventually need better logic to walk up |
| 269 // subdirectories until we hit one that looks package-like. For now, | 271 // subdirectories until we hit one that looks package-like. For now, |
| 270 // just assume the cwd is it. | 272 // just assume the cwd is it. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 if (exception is HttpException || exception is HttpParserException || | 322 if (exception is HttpException || exception is HttpParserException || |
| 321 exception is SocketIOException || exception is PubHttpException) { | 323 exception is SocketIOException || exception is PubHttpException) { |
| 322 return exit_codes.UNAVAILABLE; | 324 return exit_codes.UNAVAILABLE; |
| 323 } else if (exception is FormatException) { | 325 } else if (exception is FormatException) { |
| 324 return exit_codes.DATA; | 326 return exit_codes.DATA; |
| 325 } else { | 327 } else { |
| 326 return 1; | 328 return 1; |
| 327 } | 329 } |
| 328 } | 330 } |
| 329 } | 331 } |
| OLD | NEW |