Don't fail on failed status listing (#2877)

diff --git a/lib/src/solver/version_solver.dart b/lib/src/solver/version_solver.dart
index 10f2126..e8fe5fa 100644
--- a/lib/src/solver/version_solver.dart
+++ b/lib/src/solver/version_solver.dart
@@ -435,12 +435,17 @@
       // TODO(sigurdm): This has a smell. The Git source should have a
       // reasonable behavior here (we should be able to call getVersions in a
       // way that doesn't fetch.
-      var ids = cached ??
-          (package.source is HostedSource
-              ? (await _systemCache
-                  .source(package.source)
-                  .getVersions(package.toRef(), maxAge: Duration(days: 3)))
-              : [package]);
+      List<PackageId> ids;
+      try {
+        ids = cached ??
+            (package.source is HostedSource
+                ? (await _systemCache
+                    .source(package.source)
+                    .getVersions(package.toRef(), maxAge: Duration(days: 3)))
+                : [package]);
+      } on Exception {
+        ids = <PackageId>[package];
+      }
 
       availableVersions[package.name] = ids.map((id) => id.version).toList();
     }
diff --git a/lib/src/source/hosted.dart b/lib/src/source/hosted.dart
index a6a4c17..41797ff 100644
--- a/lib/src/source/hosted.dart
+++ b/lib/src/source/hosted.dart
@@ -310,7 +310,13 @@
     // Do we have a cached version response on disk?
     versionListing ??= await _cachedVersionListingResponse(ref, maxAge);
     // Otherwise retrieve the info from the host.
-    versionListing ??= await _scheduler.schedule(ref);
+    versionListing ??= await _scheduler
+        .schedule(ref)
+        // Failures retrieving the listing here should just be ignored.
+        .catchError(
+          (_) => <PackageId, _VersionInfo>{},
+          test: (error) => error is Exception,
+        );
 
     final listing = versionListing[id];
     // If we don't have the specific version we return the empty response.
diff --git a/test/get/hosted/warn_about_discontinued_test.dart b/test/get/hosted/warn_about_discontinued_test.dart
index 2b0afc5..ac55701 100644
--- a/test/get/hosted/warn_about_discontinued_test.dart
+++ b/test/get/hosted/warn_about_discontinued_test.dart
@@ -5,6 +5,7 @@
 import 'dart:convert';
 
 import 'package:path/path.dart' as p;
+import 'package:shelf/shelf.dart';
 import 'package:test/test.dart';
 
 import 'package:pub/src/io.dart';
@@ -83,4 +84,21 @@
 Got dependencies!
 ''');
   });
+
+  test('get does not fail when status listing fails', () async {
+    await servePackages((builder) => builder..serve('foo', '1.2.3'));
+    await d.appDir({'foo': '1.2.3'}).create();
+    await pubGet();
+    final fooVersionsCache =
+        p.join(globalPackageServer.cachingPath, '.cache', 'foo-versions.json');
+    expect(fileExists(fooVersionsCache), isTrue);
+    deleteEntry(fooVersionsCache);
+    // Serve 400 on all requests.
+    globalPackageServer.extraHandlers
+      ..clear()
+      ..[RegExp('.*')] = (request) async => Response(400);
+
+    /// Even if we fail to get status we still report success if versions don't unlock.
+    await pubGet();
+  });
 }