Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 9. Error Handling

Chapter 9. Error Handling

In an ideal world, you write a program and it runs perfectly on every computer for every user and in every situation. The real world is different, however, and throws curve balls at every opportunity. Your programs are afflicted with errors you never even dreamed of. Perhaps the user types in an unexpected answer. Or you get back an empty list (which, of course, is never supposed to be empty), and then you try to access items from the list. Or maybe you try to write to a file, and you don't have the correct permissions to do so. These types of events often generate errors that cause your program to terminate. Predicting these types of errors and handling them gracefully is one of the keys to being a good programmer. It is also the subject of this chapter.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial