| 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 library command_lish; | 5 library command_lish; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:json'; | 9 import 'dart:json'; |
| 10 import 'dart:uri'; | 10 import 'dart:uri'; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 }).catchError((asyncError) { | 85 }).catchError((asyncError) { |
| 86 if (asyncError.error is! PubHttpException) throw asyncError; | 86 if (asyncError.error is! PubHttpException) throw asyncError; |
| 87 var url = asyncError.error.response.request.url; | 87 var url = asyncError.error.response.request.url; |
| 88 if (url.toString() == cloudStorageUrl.toString()) { | 88 if (url.toString() == cloudStorageUrl.toString()) { |
| 89 // TODO(nweiz): the response may have XML-formatted information about | 89 // TODO(nweiz): the response may have XML-formatted information about |
| 90 // the error. Try to parse that out once we have an easily-accessible | 90 // the error. Try to parse that out once we have an easily-accessible |
| 91 // XML parser. | 91 // XML parser. |
| 92 throw 'Failed to upload the package.'; | 92 throw 'Failed to upload the package.'; |
| 93 } else if (url.origin == server.origin) { | 93 } else if (url.origin == server.origin) { |
| 94 handleJsonError(asyncError.error.response); | 94 handleJsonError(asyncError.error.response); |
| 95 } else { |
| 96 throw asyncError; |
| 95 } | 97 } |
| 96 }); | 98 }); |
| 97 } | 99 } |
| 98 | 100 |
| 99 Future onRun() { | 101 Future onRun() { |
| 100 if (force && dryRun) { | 102 if (force && dryRun) { |
| 101 log.error('Cannot use both --force and --dry-run.'); | 103 log.error('Cannot use both --force and --dry-run.'); |
| 102 this.printUsage(); | 104 this.printUsage(); |
| 103 exit(exit_codes.USAGE); | 105 exit(exit_codes.USAGE); |
| 104 } | 106 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 return confirm(message).then((confirmed) { | 199 return confirm(message).then((confirmed) { |
| 198 if (!confirmed) { | 200 if (!confirmed) { |
| 199 log.error("Package upload canceled."); | 201 log.error("Package upload canceled."); |
| 200 return false; | 202 return false; |
| 201 } | 203 } |
| 202 return true; | 204 return true; |
| 203 }); | 205 }); |
| 204 }); | 206 }); |
| 205 } | 207 } |
| 206 } | 208 } |
| OLD | NEW |