File: Installers\NuGet\Exceptions\PackageNotFoundException.cs
Web Access
Project: src\src\sdk\src\TemplateEngine\Microsoft.TemplateEngine.Edge\Microsoft.TemplateEngine.Edge.csproj (Microsoft.TemplateEngine.Edge)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using NuGet.Versioning;

namespace Microsoft.TemplateEngine.Edge.Installers.NuGet
{
    internal class PackageNotFoundException : Exception
    {
        public PackageNotFoundException(string packageIdentifier, IEnumerable<string> attemptedSources) : base($"{packageIdentifier} was not found in NuGet feeds {string.Join(";", attemptedSources)}")
        {
            PackageIdentifier = packageIdentifier;
            SourcesList = attemptedSources;
        }

        public PackageNotFoundException(string packageIdentifier, NuGetVersion packageVersion, IEnumerable<string> attemptedSources) : base($"{packageIdentifier}@{packageVersion} was not found in NuGet feeds {string.Join(";", attemptedSources)}")
        {
            PackageIdentifier = packageIdentifier;
            PackageVersion = packageVersion;
            SourcesList = attemptedSources;
        }

        public string PackageIdentifier { get; private set; }

        public NuGetVersion? PackageVersion { get; private set; }

        public IEnumerable<string> SourcesList { get; private set; }
    }
}