Page 119 -
P. 119

files and exceptions


          Two very different approaches








                                                                             Or you could decide to let the
            When you have to deal with a                                     errors occur, then simply handle
           bunch of exceptional situations, the                              each error if and when it happens.
           best approach is to add extra logic.                              That would be exceptional.
           If there’s more stuff to worry
           about, you need more code.











                                                                             Joe
                                   Jill























           Jill’s suggested approach certainly works: add the extra logic required to work out
           whether it’s worth invoking split() on the line of data. All you need to do is
           work out how to check the line of data.

           Joe’s approach works, too: let the error occur, spot that it has happened, and then
           recover from the runtime error…somehow.


           Which approach works best here?

                                                                                       you are here 4    83
   114   115   116   117   118   119   120   121   122   123   124