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

Unified Diff: lib/src/source/hosted.dart

Issue 1226133003: Fix several problems with offline mode. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | test/hosted/offline_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source/hosted.dart
diff --git a/lib/src/source/hosted.dart b/lib/src/source/hosted.dart
index c9ab68e0fa8bb58dabf666bbfbf71e968b2bbeca..649ce58e939f6cdbbaf4c7d16d337a8b87a11e16 100644
--- a/lib/src/source/hosted.dart
+++ b/lib/src/source/hosted.dart
@@ -252,7 +252,10 @@ class OfflineHostedSource extends HostedSource {
.toList();
// If there are no versions in the cache, report a clearer error.
- if (versions.isEmpty) fail("Could not find package $name in cache.");
+ if (versions.isEmpty) {
+ throw new PackageNotFoundException(
+ "Could not find package $name in cache.");
+ }
return versions;
}
@@ -264,12 +267,9 @@ class OfflineHostedSource extends HostedSource {
throw new UnsupportedError("Cannot download packages when offline.");
}
- Future<Pubspec> doDescribeUncached(PackageId id) {
- // [getVersions()] will only return packages that are already cached.
- // [CachedSource] will only call [doDescribeUncached()] on a package after
- // it has failed to find it in the cache, so this code should not be
- // reached.
- throw new UnsupportedError("Cannot describe packages when offline.");
+ Future<Pubspec> describeUncached(PackageId id) {
+ throw new PackageNotFoundException(
+ "${id.name} ${id.version} is not available in your system cache.");
}
}
« no previous file with comments | « no previous file | test/hosted/offline_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698