GetDetailsException.cs (1713B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="GetDetailsException.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.WinGet.Configuration.Engine.Exceptions 8 { 9 using System; 10 using System.Collections.Generic; 11 using Microsoft.Management.Configuration; 12 using Microsoft.WinGet.Configuration.Engine.PSObjects; 13 using Microsoft.WinGet.Resources; 14 15 /// <summary> 16 /// Exception thrown while getting details. 17 /// </summary> 18 public class GetDetailsException : Exception 19 { 20 /// <summary> 21 /// Initializes a new instance of the <see cref="GetDetailsException"/> class. 22 /// </summary> 23 /// <param name="unitResults">Unit results.</param> 24 internal GetDetailsException(IReadOnlyList<GetConfigurationUnitDetailsResult>? unitResults = null) 25 : base(Resources.ConfigurationFailedToGetDetails) 26 { 27 var results = new List<PSGetConfigurationDetailsResult>(); 28 29 if (unitResults != null) 30 { 31 foreach (var result in unitResults) 32 { 33 results.Add(new PSGetConfigurationDetailsResult(result)); 34 } 35 } 36 37 this.UnitDetailsResults = results; 38 } 39 40 /// <summary> 41 /// Gets the unit details result. 42 /// </summary> 43 public IReadOnlyList<PSGetConfigurationDetailsResult> UnitDetailsResults { get; private init; } 44 } 45 }