Created
December 23, 2015 07:14
-
-
Save PlagueHO/1e9f3d8e8d885c3dfecc to your computer and use it in GitHub Desktop.
Example DSC Custom Exception
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
$errorId = 'iSCSIVirtualDiskRequiresRecreateError' | |
$errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument | |
$errorMessage = $($LocalizedData.iSCSIVirtualDiskRequiresRecreateError) -f $Path | |
$exception = New-Object -TypeName System.InvalidOperationException ` | |
-ArgumentList $errorMessage | |
$errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` | |
-ArgumentList $exception, $errorId, $errorCategory, $null | |
$PSCmdlet.ThrowTerminatingError($errorRecord) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment