Skip to content

Instantly share code, notes, and snippets.

@lantrix
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save lantrix/1e34ed4a1be1f2507dff to your computer and use it in GitHub Desktop.

Select an option

Save lantrix/1e34ed4a1be1f2507dff to your computer and use it in GitHub Desktop.
Powershell Throw, Catch, Finally example passing Throw Text
$throwError = ""
try {
throw "exception has occured! Failure text"
} catch {
#Catch throw test
$throwError = $_
} finally {
if ([bool]$throwError) {
Write-Host "$throwError"
} else {
Write-Host "Finished Successfully"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment