Skip to content

Commit 7abc53a

Browse files
committed
Update Remove-SqlDscRole to improve error handling by using ItemNotFoundException
1 parent fbc4055 commit 7abc53a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/Public/Remove-SqlDscRole.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ function Remove-SqlDscRole
9696

9797
$PSCmdlet.ThrowTerminatingError(
9898
[System.Management.Automation.ErrorRecord]::new(
99-
[System.InvalidOperationException]::new($errorMessage),
99+
[System.Management.Automation.ItemNotFoundException]::new($errorMessage),
100100
'RSDR0001', # cspell: disable-line
101-
[System.Management.Automation.ErrorCategory]::InvalidOperation,
101+
[System.Management.Automation.ErrorCategory]::ObjectNotFound,
102102
$Name
103103
)
104104
)

0 commit comments

Comments
 (0)