Comments

jetdv wrote on 1/3/2005, 6:35 PM
Error catching and dying gracefully when errors do occur.
hdguru wrote on 1/3/2005, 6:58 PM
Hmm. Not too descriptive, yet I feel I should start using it. :)
rcampbel wrote on 1/3/2005, 7:10 PM
Sometimes method calls will throw an exception if something goes wrong. try/catch allows the programmer to catch these exceptions and take some action. For example, a File.Open() method may throw an exception if the file is already in use.

If an exception is thrown that is not caught, it is called an unhandled exception. In this case, the framework will display a dialog and terminate the script.

In my C# programs, I catch all exceptions so that I can log them in a trace file and optionally allow the user to email the info about the exception to me. This is one reason to put a try/catch around the entire program.

Randall