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

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

Issue 12428012: Properly handle errors from the OAuth2 token endpoint in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor changes Created 7 years, 9 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/http.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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/http.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698