Last active
August 29, 2015 14:20
-
-
Save Jaykul/bd8a6bbc13aef1b2f2a3 to your computer and use it in GitHub Desktop.
Exceptions and Errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
&{ | |
[CmdletBinding()]param() | |
&{[CmdletBinding()]param() Write-Error "Demo Error 1" } -EA 0 -EV e; | |
$PSCmdlet.WriteError($e[0]); | |
1/0 | |
&{[CmdletBinding()]param() Write-Error "Demo Error 2" } -EA 0 -EV e; | |
$PSCmdlet.ThrowTerminatingError($e[0]) | |
} | |
$e = $Error[0..2] | |
$e | % { $_.Exception } | fl * -force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment