Zack - Day 22

0 0 1 385 2199 Concentrated Technology 18 5 2579 14.0 Normal 0 false false false EN-US JA X-NONE

Trapping and handling errors, how I wish something should have trapped the poison that my toddler brought home from daycare.  It has stricken me with burning eyes, sore joints, coughing, drippy nose, and a relentless 102 degree fever.   Beat-down and tired thinking of a lunch was nauseating, rest is what I needed.  I mean I tired the whole "Wife read it to me thing" but that sounded like a robot that was programmed to speak bocce, so did not work and I love her for trying. Fever dropped to 100 and I am ready to read, I am so close to reaching my goal. 

I actually ran into the need for handling errors last week, needed to pull all  running services of all machines and I missed a few.  After reading this chapter I deployed the knowledge gained and created a sweet list of machines that did not respond to my initial query.  I will revisit them soon.

There are some key concepts of terminating and non-terminating problems, as well as turning and error into an exception.  I have noticed a lot of ‘SilentlyContinue' throughout the forums, now after taking the time I can see where is maybe used in questionable places.  Don mentions that sometimes this is found at the top of many scripts and often leads to data that is misleading.

Reading about Trap I was convinced that this would be the answer to all my error handling needs, but moving forward with the reading and some practice it does seem to be clunky and not as smooth as what I would expect from PowerShell. I mean after all PowerShell is fast and smooth so far, why clunk it up with error handling?

Now Try just sounds nice, like "Hey PowerShell Try this! Awe that didn't work, well then Try this!" So nice and fluid, just what I would expect from the PowerShell Team, they totally redeemed themselves with Try. I really like the ability to add script feedback with Try and Finally, gives users of the script that warm and fuzzy of a completed operation.  Not sure if error handling is more for me or the users of these scripts, I feel as though it would benefit both but I think it will pay dividends on my end.

If this post appears fuzzy it maybe because of all the sweet cold medicine that is whirling in my blood stream to calm the fever that I have been experiencing.  Regardless Trapping and handling errors has been a chapter that rocks and is beneficial to any script.

I have been missing my lunch battling this cold, looking forward to moving forward, the book is doing that funny "I want to close" thing since there is so little remaining. http://morelunches.com/

 

 


Posted Apr 03 2012, 04:41 PM by Don Jones
Copyright 2012 PowerShell.com. All rights reserved.