| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return location; | 83 return location; |
| 84 }).then((location) => client.get(location)) | 84 }).then((location) => client.get(location)) |
| 85 .then(handleJsonSuccess); | 85 .then(handleJsonSuccess); |
| 86 }).catchError((error) { | 86 }).catchError((error) { |
| 87 if (error is! PubHttpException) throw error; | 87 if (error is! PubHttpException) throw error; |
| 88 var url = error.response.request.url; | 88 var url = error.response.request.url; |
| 89 if (urisEqual(url, cloudStorageUrl)) { | 89 if (urisEqual(url, cloudStorageUrl)) { |
| 90 // TODO(nweiz): the response may have XML-formatted information about | 90 // TODO(nweiz): the response may have XML-formatted information about |
| 91 // the error. Try to parse that out once we have an easily-accessible | 91 // the error. Try to parse that out once we have an easily-accessible |
| 92 // XML parser. | 92 // XML parser. |
| 93 throw 'Failed to upload the package.'; | 93 throw new Exception('Failed to upload the package.'); |
| 94 } else if (urisEqual(Uri.parse(url.origin), Uri.parse(server.origin))) { | 94 } else if (urisEqual(Uri.parse(url.origin), Uri.parse(server.origin))) { |
| 95 handleJsonError(error.response); | 95 handleJsonError(error.response); |
| 96 } else { | 96 } else { |
| 97 throw error; | 97 throw error; |
| 98 } | 98 } |
| 99 }); | 99 }); |
| 100 } | 100 } |
| 101 | 101 |
| 102 Future onRun() { | 102 Future onRun() { |
| 103 if (force && dryRun) { | 103 if (force && dryRun) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 return confirm(message).then((confirmed) { | 198 return confirm(message).then((confirmed) { |
| 199 if (!confirmed) { | 199 if (!confirmed) { |
| 200 log.error("Package upload canceled."); | 200 log.error("Package upload canceled."); |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 return true; | 203 return true; |
| 204 }); | 204 }); |
| 205 }); | 205 }); |
| 206 } | 206 } |
| 207 } | 207 } |
| OLD | NEW |