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

Unified Diff: utils/pub/http.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/hosted_source.dart ('k') | utils/pub/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/http.dart
diff --git a/utils/pub/http.dart b/utils/pub/http.dart
index 8df0575fe0a8084d14c41e73e954945d7484cb50..8a98313723470ca52668c546223fd4efae25924c 100644
--- a/utils/pub/http.dart
+++ b/utils/pub/http.dart
@@ -69,10 +69,10 @@ class PubHttpClient extends http.BaseClient {
error.osError.errorCode == -5 ||
error.osError.errorCode == 11001 ||
error.osError.errorCode == 11004) {
- throw 'Could not resolve URL "${request.url.origin}".';
+ fail('Could not resolve URL "${request.url.origin}".');
} else if (error.osError.errorCode == -12276) {
- throw 'Unable to validate SSL certificate for '
- '"${request.url.origin}".';
+ fail('Unable to validate SSL certificate for '
+ '"${request.url.origin}".');
}
}
throw error;
@@ -187,9 +187,8 @@ Map parseJsonResponse(http.Response response) {
}
/// Throws an error describing an invalid response from the server.
-void invalidServerResponse(http.Response response) {
- throw 'Invalid server response:\n${response.body}';
-}
+void invalidServerResponse(http.Response response) =>
+ fail('Invalid server response:\n${response.body}');
/// Exception thrown when an HTTP operation fails.
class PubHttpException implements Exception {
« no previous file with comments | « utils/pub/hosted_source.dart ('k') | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698