Index: sdk/lib/_internal/pub/lib/src/global_packages.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/global_packages.dart b/sdk/lib/_internal/pub/lib/src/global_packages.dart |
index 57f806a14af74b18b587438eab3041b827c7fc01..d762507354f30642062949cdae9e8ac54893b8e6 100644 |
--- a/sdk/lib/_internal/pub/lib/src/global_packages.dart |
+++ b/sdk/lib/_internal/pub/lib/src/global_packages.dart |
@@ -110,7 +110,13 @@ class GlobalPackages { |
// Resolve it and download its dependencies. |
return resolveVersions(SolveType.GET, cache.sources, root).then((result) { |
- if (!result.succeeded) throw result.error; |
+ if (!result.succeeded) { |
+ // If the package specified by the user doesn't exist, we want to |
+ // surface that as a [DataError] with the associated exit code. |
+ if (result.error.package != dep.name) throw result.error; |
+ if (result.error is NoVersionException) dataError(result.error.message); |
+ throw result.error; |
+ } |
result.showReport(SolveType.GET); |
// Make sure all of the dependencies are locally installed. |