Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Powershell script designing

$
0
0

Just depends on what your requirements for the error handling / reporting are. If all you’re doing is rethrowing the error (as in my example), there’s no advantage to having three separate try/catch blocks rather than one. If you’re wrapping the error in a new object or reformatting it in some way (as your (throw # mesages relevant to task 2) example seems to imply), then it’s better to have a separate try block for each task.


Viewing all articles
Browse latest Browse all 13067

Trending Articles