Created
May 6, 2015 00:22
-
-
Save Jaykul/3db6f1553500350a9f69 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
[324]: try { | |
· try{ | |
· throw [System.Management.Automation.ParameterBindingException]::new( "whatever", | |
· [System.Management.Automation.ItemNotFoundException]::new("File Not Found")) | |
· } catch{ throw $_} | |
· } catch [System.Management.Automation.ParameterBindingException] { "PBE" } | |
· catch [System.Management.Automation.ItemNotFoundException] { "INFE" } | |
PBE | |
[325]: | |
· try { | |
· try{ | |
· throw [System.Management.Automation.ParameterBindingException]::new( "whatever", | |
· [System.Management.Automation.ItemNotFoundException]::new("File Not Found")) | |
· } catch [System.Management.Automation.ParameterBindingException] { "PBE1" } | |
· catch [System.Management.Automation.ItemNotFoundException] { "INFE1"; throw $_ } | |
· catch { Write-Host "Rethrow Anyway"; throw } | |
· } catch [System.Management.Automation.ParameterBindingException] { "PBE2" } | |
· catch [System.Management.Automation.ItemNotFoundException] { "INFE2" } | |
INFE1 | |
INFE2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment