-
Website
http://HuddledMasses.org/ -
Original page
http://HuddledMasses.org/trap-exception-in-powershell/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
Clint Ecker
1 comment · 5 points
-
avenzke
1 comment · 1 points
-
Euri
1 comment · 4 points
-
Stuart
1 comment · 1 points
-
Luciano Evaristo Guerche
1 comment · 1 points
-
-
Popular Threads
http://cashfoley.com/2007/10/13/TryFinallyCatch...
The origian post is by Adam Weigert at http://weblogs.asp.net/adweigert/archive/2007/1...
Actually, you can nest the Try-Finally-Catch blocks effectively.
There are a couple of side effects I've learned and I'll blog it in the near future. In short, whenever you use a scriptblock, you effectively creates a scope for variables. As a result, varibales created or changed in a Try Section are unavailable in the Finaly or Catch scriptblocks. This is not a big deal but it might need to be anticipated. Also, this is not a specific effect from Try-Finally-Catch. It happens with all scriptblocks. This is usually managed by "dotting" the script. I just haven't found a way to work it into the Try-Finally-Catch commandlet.
Cash Foley