So far in this book I have stayed away from any involved error handling. This was mainly to get rid of any extraneous code that was not directly related to the task at hand. However, I cannot hold off any longer. I do not want you to think that you can just go out programming and hope for the best.
No matter how good a programmer you are, you will need to provide some means of handling errors that occur. Here are some main sources of errors:
Coding bugs
Inability to open files
Coding bugs
Wrong user input
Coding bugs
Unexpected data
Coding bugs
As far as this book is concerned, error handling goes hand in hand with data validation. After all, if your data is always good, there is no need to validate and no need to throw errors.