| 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() {
|
|
|