Change ThrowError to Throw

This commit is contained in:
Wes Carroll
2019-07-19 14:22:56 -04:00
parent 1cfc07260f
commit 0c4643a76e
@@ -18,12 +18,12 @@ function Invoke-ZertoRestRequest {
$callerErrorActionPreference = $ErrorActionPreference $callerErrorActionPreference = $ErrorActionPreference
# If the ZVM server and Port not defined, Stop Call # If the ZVM server and Port not defined, Stop Call
if ( -not ((Test-Path variable:script:zvmServer) -and (Test-Path variable:script:zvmPort)) ) { if ( -not ((Test-Path variable:script:zvmServer) -and (Test-Path variable:script:zvmPort)) ) {
ThrowError -ExceptionName "NoConnection" -ExceptionMessage "Zerto Connection does not Exist. Please run Connect-ZertoServer first to establish a connection" -errorId "Connection01" -errorCategory "Connection" -ErrorAction Stop Throw "Zerto Connection does not Exist. Please run Connect-ZertoServer first to establish a connection"
} }
# If the Headers exist and the Last action was more than 30 minutes ago, Session is Expired # If the Headers exist and the Last action was more than 30 minutes ago, Session is Expired
if ( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(get-date) ) { if ( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(get-date) ) {
ThrowError -ExceptionName "ExpiredToken" -ExceptionMessage "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager" -errorId "ZVMAuth01" -errorCategory "Auth" -ErrorAction Stop Throw "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager"
} else { } else {
# Build the URI to be submitted # Build the URI to be submitted