Traps vs Try/Catch

Someone as asking about Traps vs Try/Catch and Jason Shirk (PowerShell developer) gave a nice concise and precise answer that I thought I would share with you: Trap: Designed for admins V1 and V2 Introduces a new scope Is “global”, meaning it applies to all code in the same scope, before or after. Does not support rethrow (an empty throw statement throws a special RuntimeException with Read More...

Read the complete post at http://blogs.msdn.com/powershell/archive/2009/06/17/traps-vs-try-catch.aspx


Posted Jun 16 2009, 11:05 PM by Windows PowerShell Blog
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.