Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigInstructions should include location of offending line in exception for duplicate resources #14

Open
alx9r opened this issue Nov 26, 2016 · 0 comments
Labels

Comments

@alx9r
Copy link
Owner

alx9r commented Nov 26, 2016

Executing

ConfigInstructions Name {
    Get-DscResource TestStub | Import-DscResource
    Get-DscResource TestStub | Import-DscResource
    TestStub a @{ Key = 'a' }
}

raises the exception

Duplicate resource named TestStub
At C:\Users\un1\Documents\WindowsPowerShell\Modules\ZeroDSC\Functions\configDocumentType.ps1:94 char:17
+                 throw [System.FormatException]::new(
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], FormatException
    + FullyQualifiedErrorId : Duplicate resource named TestStub

The file name and line number of the second Import-DscResource should be reported in the exception.

A test for this behavior is already mentioned in configDocumentType.Tests.ps1

@alx9r alx9r added the Feature label Nov 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant