DISQUS

DISQUS Hello!  The comments on this profile are unclaimed and thus are unverified.

Do they belong to you? Claim these comments.

Cash Foley's picture

Unregistered

Feeds

aliases

  • Cash Foley
  • cash foley

Cash Foley

1 year ago

in Trap [Exception] { “In PowerShell” } on Huddled Masses
You qualified the Try-Finally-Catch "as long as you’re able to handle all of your exceptions in a single trap".

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

1 year ago

in Trap [Exception] { “In PowerShell” } on Huddled Masses
I made some comentary on a Try... Catch... Finally... function at

http://cashfoley.com/2007/10/13/TryFinallyCatch...

The origian post is by Adam Weigert at http://weblogs.asp.net/adweigert/archive/2007/1...
Returning? Login