Description
Replace the raw throw statement in DSC_SChannelSettings.psm1 (lines 599-600) with New-InvalidOperationException using a localized message.
Changes Needed
-
Add a new localized string key to source/DSCResources/DSC_SChannelSettings/en-US/DSC_SChannelSettings.strings.psd1:
HotfixNotInstalled = 'Hotfix KB3140245 is not installed. Setting these registry keys will not do anything. Please install the hotfix first.'
-
Replace the throw statement in source/DSCResources/DSC_SChannelSettings/DSC_SChannelSettings.psm1 (lines 599-600):
# Current:
throw ('Hotfix KB3140245 is not installed. Setting these registry keys will not do anything. ' + `
'Please install the hotfix first!')
# Should be:
New-InvalidOperationException -Message $script:localizedData.HotfixNotInstalled
Context
MOF-based DSC resources must use New-InvalidOperationException instead of raw throw statements for proper error handling, and all user-facing strings must be localized.
References
Description
Replace the raw
throwstatement inDSC_SChannelSettings.psm1(lines 599-600) withNew-InvalidOperationExceptionusing a localized message.Changes Needed
Add a new localized string key to
source/DSCResources/DSC_SChannelSettings/en-US/DSC_SChannelSettings.strings.psd1:Replace the throw statement in
source/DSCResources/DSC_SChannelSettings/DSC_SChannelSettings.psm1(lines 599-600):Context
MOF-based DSC resources must use
New-InvalidOperationExceptioninstead of rawthrowstatements for proper error handling, and all user-facing strings must be localized.References