It happens: you run a script or execute a command, and something doesn't work quite right. You get an ugly red error. Now what?
There are many ways to handle this. When you're sitting at the console, frequently it comes down to simply reading the error message and figuring out what you forgot or mistyped. These are often the easiest errors to deal with just for the fact that they're interactive by nature, so you get the opportunity to try other things until you get the results you're looking for before proceeding.
Things get a lot more complicated, however, when you're writing a script, especially one that is meant to run without someone sitting at a console to see the errors. At least if the script is being run manually, the person sitting at the console will be able to see that something did go wrong; when it's unattended, though, frequently you wind up losing valuable clues as to what went wrong, so you need to think about how your script could fail and account for that ahead of time with error handling.Read More