File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed
Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -108,14 +108,9 @@ function Get-SqlDscRSConfiguration
108108 {
109109 $errorMessage = $script :localizedData.Get_SqlDscRSConfiguration_FailedToGetConfiguration -f $InstanceName , $_.Exception.Message
110110
111- $PSCmdlet.ThrowTerminatingError (
112- [System.Management.Automation.ErrorRecord ]::new(
113- [System.InvalidOperationException ]::new($errorMessage , $_.Exception ),
114- ' GSRSCD0003' ,
115- [System.Management.Automation.ErrorCategory ]::InvalidOperation,
116- $InstanceName
117- )
118- )
111+ $errorRecord = New-ErrorRecord - Exception (New-InvalidOperationException - Message $errorMessage - ErrorRecord $_ - PassThru) - ErrorId ' GSRSCD0003' - ErrorCategory ' InvalidOperation' - TargetObject $InstanceName
112+
113+ $PSCmdlet.ThrowTerminatingError ($errorRecord )
119114 }
120115
121116 # Filter to ensure we get the correct instance if multiple are returned.
@@ -128,14 +123,9 @@ function Get-SqlDscRSConfiguration
128123 {
129124 $errorMessage = $script :localizedData.Get_SqlDscRSConfiguration_ConfigurationNotFound -f $InstanceName
130125
131- $PSCmdlet.ThrowTerminatingError (
132- [System.Management.Automation.ErrorRecord ]::new(
133- [System.InvalidOperationException ]::new($errorMessage ),
134- ' GSRSCD0004' ,
135- [System.Management.Automation.ErrorCategory ]::ObjectNotFound,
136- $InstanceName
137- )
138- )
126+ $errorRecord = New-ErrorRecord - Exception (New-InvalidOperationException - Message $errorMessage - PassThru) - ErrorId ' GSRSCD0004' - ErrorCategory ' ObjectNotFound' - TargetObject $InstanceName
127+
128+ $PSCmdlet.ThrowTerminatingError ($errorRecord )
139129 }
140130
141131 return $reportingServicesConfiguration
You can’t perform that action at this time.
0 commit comments