I've read the about_try_catch_finally via powershell help.
I want to incorporate try-catch-finally in my Powershell-scripting. In example i tried the code attached. dividebyzero is caught (example via google), and then i tried system.io.FileNotFound (I know i can use test-path, but I'm just examining). 'Finally' will run but the Catch wont catch and run the code.
1) Can any1 explain why
2) I really need to learn exceptions - Any suggestions/links that will give me focus in that process?
#"The first Catch script block handles System.DivideByZeroException exceptions"
"Catched! Attempted to divide by zero"
"the second Catch script block handles any non-specific exceptions"
"Ahh Survived the divide by zero error"
$hej = Get-Content "asdf.txt"
"Catched! File not found muahhahaha"
"Phew - survived the File not found"