| Index: utils/pub/hosted_source.dart
|
| diff --git a/utils/pub/hosted_source.dart b/utils/pub/hosted_source.dart
|
| index 97b8d17786e258be8fe971231205b0e1544de3d8..5e48153260e195d4206ea1c48b11a65d650c5729 100644
|
| --- a/utils/pub/hosted_source.dart
|
| +++ b/utils/pub/hosted_source.dart
|
| @@ -4,7 +4,6 @@
|
|
|
| #library('hosted_source');
|
|
|
| -#import('dart:io');
|
| #import('dart:json');
|
| #import('dart:uri');
|
| #import('io.dart');
|
| @@ -35,9 +34,17 @@ class HostedSource extends Source {
|
| Future<List<Version>> getVersions(description) {
|
| var parsed = _parseDescription(description);
|
| var fullUrl = "${parsed.last}/packages/${parsed.first}.json";
|
| - return consumeInputStream(httpGet(fullUrl)).transform((data) {
|
| - var doc = JSON.parse(new String.fromCharCodes(data));
|
| +
|
| + return httpGetString(fullUrl).transform((body) {
|
| + var doc = JSON.parse(body);
|
| return doc['versions'].map((version) => new Version.parse(version));
|
| + }).transformException((ex) {
|
| + if (ex is HttpException && ex.statusCode == 404) {
|
| + throw 'Could not find package "${parsed.first}" on ${parsed.last}.';
|
| + }
|
| +
|
| + // Otherwise re-throw the original exception.
|
| + throw ex;
|
| });
|
| }
|
|
|
|
|