Packaging: Fixing that trying to install a package that doesn't exist should display a relevant error notification, fixes #6533

This commit is contained in:
Geert Doornbos
2019-05-23 14:10:43 +02:00
committed by Benedek Farkas
parent 759f50c5c0
commit f692fc36a9

View File

@@ -54,7 +54,9 @@ namespace Orchard.Packaging.Services {
var packageVersion = String.IsNullOrEmpty(version) ? null : new Version(version);
var package = packageRepository.FindPackage(packageId, packageVersion);
if (package == null) {
throw new ArgumentException(T("The specified package could not be found, id:{0} version:{1}", packageId, String.IsNullOrEmpty(version) ? T("No version").Text : version).Text);
var message = T("The specified package could not be found: ID: {0}, version: {1}.",
packageId, string.IsNullOrEmpty(version) ? T("No version").Text : version);
throw new OrchardException(message);
}
return InstallPackage(package, packageRepository, location, applicationPath);