Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: utils/pub/command_lish.dart

Issue 14253005: Migrate pub away from throwing strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 8 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 | utils/pub/entrypoint.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) 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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/entrypoint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698