[Tutor] exceptions

Sean 'Shaleh' Perry shalehperry@attbi.com
Sat, 13 Apr 2002 19:47:39 -0700 (PDT)


On 14-Apr-2002 Cameron Stoner wrote:
> Hi all,
> 
> How do you approach error trapping and use exceptions in Python to take care
> of it?  How do you for all the possible dumb user mistakes?  I mean give me
> the kind of thought process of how I should go about thinking this through in
> planning my program.
> 

I tend to write it through once clean without error checking (or minimal
checking).  Thne I use it and see what happens.  As I start to add code to
catch this I look at all the possible errors go from there.

A lot of working with exceptions is knowing where to put the handler.  This
just becomes intuitive as you get used to it.  The key is the error code should
not distract too much from the workings of the program.  If you find youself
reading more error code than actual application code you probably need to
rethink things.