InstallDscResourceException.cs (1562B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="InstallDscResourceException.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.Management.Configuration.Processor.Exceptions 8 { 9 using System; 10 using Microsoft.PowerShell.Commands; 11 12 /// <summary> 13 /// Installing a DSC resource failed unexpectedly. 14 /// </summary> 15 internal class InstallDscResourceException : Exception 16 { 17 /// <summary> 18 /// Initializes a new instance of the <see cref="InstallDscResourceException"/> class. 19 /// </summary> 20 /// <param name="resourceName">Resource name.</param> 21 /// <param name="module">Module.</param> 22 public InstallDscResourceException(string resourceName, ModuleSpecification? module) 23 : base($"Unable to find resource after install: {resourceName} [{module?.ToString() ?? "<no module>"}]") 24 { 25 this.HResult = ErrorCodes.WinGetConfigUnitNotFound; 26 this.ResourceName = resourceName; 27 this.Module = module; 28 } 29 30 /// <summary> 31 /// Gets the resource name. 32 /// </summary> 33 public string ResourceName { get; } 34 35 /// <summary> 36 /// Gets the module, if any. 37 /// </summary> 38 public ModuleSpecification? Module { get; } 39 } 40 }