[Tutor] Universal error handler

Matti Niemelä matti at niemelat.net
Tue Jun 20 22:33:03 CEST 2006


Thank you all for your replies.

 > It looks a lot like what you asked for! What do you find
 > disfunctional? Is it the call to the main function?

I'm just trying to find a way not to indent the code more then 
necessary. Makes it messy. That's just me :)


> Chances are you may have already seen this, but here are a list of the different Python errors you can catch:
> http://www.python.org/doc/1.5.2p2/api/standardExceptions.html 

Thank you Emily Fortuna for the error types list, just what I was also 
after (no doubt Google wouldn't have told me those, but thanks anyways =D )


Kent
> For beginners, often the best solution is not to catch the errors at 
> all, but let the runtime catch it and give you a stack trace and error 
> message.

No problem there. Somewhat 5 years of PHP now, so normal debuggin etc. 
is all routine for me. And since I tend to aim for perfection and the 
gratest simplicity, I indeed want to handle the errors properly :)


I'm propably going to clean up my contacts script (what I was talking 
about originally) and put it here, since I'd like to get some feedback 
on the way I write Python.

Thank you all,
- Matti
Finland


More information about the Tutor mailing list