Skip to content

@akimboyko /gist:4258647
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
PowerShell exception re-throwing sample
Write-Host 'throw'
try
{
try
{
throw "exception"
}
catch
{
Write-Host $_
Write-Host $_.GetType()
Write-Host $_.Exception
Write-Host $_.Exception.StackTrace
throw
}
}
catch
{
Write-Host $_
Write-Host $_.GetType()
Write-Host $_.Exception
Write-Host $_.Exception.StackTrace
Write-Host $err
}
Write-Host 'throw (exception)'
try
{
try
{
$exception = New-Object System.Exception ("test")
throw $exception
}
catch
{
Write-Host $_
Write-Host $_.GetType()
Write-Host $_.Exception
Write-Host $_.Exception.StackTrace
throw
}
}
catch
{
Write-Host $_
Write-Host $_.GetType()
Write-Host $_.Exception
Write-Host $_.Exception.StackTrace
Write-Host $err
}
Write-Host 'throw $_'
try
{
try
{
$exception = New-Object System.Exception ("test")
throw $exception
}
catch
{
Write-Host $_
Write-Host $_.GetType()
Write-Host $_.Exception
Write-Host $_.Exception.StackTrace
throw $_
}
}
catch
{
Write-Host $_
Write-Host $_.GetType()
Write-Host $_.Exception
Write-Host $_.Exception.StackTrace
Write-Host $err
}
Write-Host 'throw $_.Exception'
try
{
try
{
$exception = New-Object System.Exception ("test")
throw $exception
}
catch
{
Write-Host $_
Write-Host $_.GetType()
Write-Host $_.Exception
Write-Host $_.Exception.StackTrace
throw $_.Exception
}
}
catch
{
Write-Host $_
Write-Host $_.GetType()
Write-Host $_.Exception
Write-Host $_.Exception.StackTrace
Write-Host $err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.