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

Unified Diff: tools/gardening/lib/src/util.dart

Issue 2986223002: Add tests for BuildGroup names (Closed)
Patch Set: Updated cf. comments Created 3 years, 4 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 | « tools/gardening/lib/src/client.dart ('k') | tools/gardening/test/buildbot_data_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/lib/src/util.dart
diff --git a/tools/gardening/lib/src/util.dart b/tools/gardening/lib/src/util.dart
index e7ea13461a4c1695b4d8f59614bd617855d31da8..f21703aba560c0d9c327e1afa43612dcc5ac5d86 100644
--- a/tools/gardening/lib/src/util.dart
+++ b/tools/gardening/lib/src/util.dart
@@ -43,11 +43,24 @@ void log(Object text) {
if (LOG) print(text);
}
+class HttpException implements Exception {
+ final Uri uri;
+ final int statusCode;
+
+ HttpException(this.uri, this.statusCode);
+
+ String toString() => '$uri: $statusCode';
+}
+
/// Reads the content of [uri] as text.
Future<String> readUriAsText(HttpClient client, Uri uri) async {
HttpClientRequest request = await client.getUrl(uri);
HttpClientResponse response = await request.close();
- return await response.transform(UTF8.decoder).join();
+ if (response.statusCode != 200) {
+ response.drain();
+ throw new HttpException(uri, response.statusCode);
+ }
+ return response.transform(UTF8.decoder).join();
}
ArgParser createArgParser() {
« no previous file with comments | « tools/gardening/lib/src/client.dart ('k') | tools/gardening/test/buildbot_data_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698