REAL-WORLD COMPUTER PROGRAMMING FOR KIDS
STEP 17: MAKE SURE AND JUST IN CASE (Or, Throwing, Catching, and Teasing of Future Logging)
A famous movie character once said, “There is no Try.” He was wrong. There definitely is a Try, and it’s very handy for programmers. Try has two partners: catch, and finally.
You might remember from Step 16 that a subset of the code we discussed looks like this:
try
{
// elided code
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
throw;
}
So wh…