-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relax restrictions for Write-Error. Log PowerShell's error stream with verbose level. Create new exception for the case when the same module version exists in different module paths.
- Loading branch information
1 parent
cda7a08
commit 0d54209
Showing
12 changed files
with
364 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/Microsoft.Management.Configuration.Processor/Exceptions/GetDscResourceModuleConflict.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// ----------------------------------------------------------------------------- | ||
// <copyright file="GetDscResourceModuleConflict.cs" company="Microsoft Corporation"> | ||
// Copyright (c) Microsoft Corporation. Licensed under the MIT License. | ||
// </copyright> | ||
// ----------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Management.Configuration.Processor.Exceptions | ||
{ | ||
using System; | ||
using System.Management.Automation; | ||
using Microsoft.PowerShell.Commands; | ||
|
||
/// <summary> | ||
/// A call to Get-DscResource failed because at least two modules with the same version where found in the module path. | ||
/// If you are getting this verify the module path. | ||
/// </summary> | ||
internal class GetDscResourceModuleConflict : Exception | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="GetDscResourceModuleConflict"/> class. | ||
/// </summary> | ||
/// <param name="resourceName">Resource name.</param> | ||
/// <param name="module">Optional module.</param> | ||
/// <param name="inner">The original runtime exception thrown.</param> | ||
public GetDscResourceModuleConflict(string? resourceName, ModuleSpecification? module, RuntimeException inner) | ||
: base($"Multiple modules with same version in module path: {resourceName?.ToString() ?? "<no resource>"} [{module?.ToString() ?? "<no module>"}]", inner) | ||
{ | ||
this.HResult = ErrorCodes.WinGetConfigUnitModuleConflict; | ||
this.ResourceName = resourceName; | ||
this.Module = module; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the resource name. | ||
/// </summary> | ||
public string? ResourceName { get; } | ||
|
||
/// <summary> | ||
/// Gets the module, if any. | ||
/// </summary> | ||
public ModuleSpecification? Module { get; } | ||
} | ||
} |
Oops, something went wrong.