Use Throw instead of ThrowTerminatingError()
This commit is contained in:
@@ -183,25 +183,11 @@ function Disconnect-SsoAdminServer {
|
|||||||
switch (@($global:DefaultSsoAdminServers).count) {
|
switch (@($global:DefaultSsoAdminServers).count) {
|
||||||
{ $_ -eq 1 } { $server = ($global:DefaultSsoAdminServers).ToArray()[0] ; break }
|
{ $_ -eq 1 } { $server = ($global:DefaultSsoAdminServers).ToArray()[0] ; break }
|
||||||
{ $_ -gt 1 } {
|
{ $_ -gt 1 } {
|
||||||
$PSCmdlet.ThrowTerminatingError(
|
Throw 'Connected to more than 1 SSO server, please specify a SSO server via -Server parameter'
|
||||||
[System.Management.Automation.ErrorRecord]::new(
|
|
||||||
([System.ApplicationException]"Connected to more than 1 SSO server, please specify a SSO server via -Server parameter"),
|
|
||||||
'Disconnect-SsoAdminServer.ConnectedToMoreThanOneSSO',
|
|
||||||
[System.Management.Automation.ErrorCategory]::InvalidOperation,
|
|
||||||
$global:DefaultSsoAdminServers
|
|
||||||
)
|
|
||||||
)
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
Default {
|
Default {
|
||||||
$PSCmdlet.ThrowTerminatingError(
|
Throw 'Not connected to SSO server.'
|
||||||
[System.Management.Automation.ErrorRecord]::new(
|
|
||||||
([System.ApplicationException]"Not connected to SSO server."),
|
|
||||||
'Disconnect-SsoAdminServer.NotConnectedToSSO',
|
|
||||||
[System.Management.Automation.ErrorCategory]::ConnectionError,
|
|
||||||
$global:DefaultSsoAdminServers
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user