This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Chris.Clark
Recipients Chris.Clark, docs@python, r.david.murray
Date 2014-03-12.23:42:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1394667775.82.0.140828297977.issue20903@psf.upfronthosting.co.za>
In-reply-to
Content
I am concerned about the policy of not documenting all exceptions that are raised. It sounds like there is no straightforward way to write a comprehensive except statement without using a bare except or catching some base exception. I consider it dangerous to catch broad exception classes because it can hide some nasty bugs. And while I may be able to use OSError here, how can I be sure that you aren't forgetting about some other unexpected exception? Furthermore, I don't want to catch all OSErrors, only those relating to the SMTP server connection failing.

I definitely agree that it is preferable to be able to differentiate different types of exceptions. It seems to me that the best solution would be to make subclasses of SMTPConnectError so that I can catch SMTPConnectError if I don't care about the type or SMTPConnectTimeoutError if I do care about the type.
History
Date User Action Args
2014-03-12 23:42:55Chris.Clarksetrecipients: + Chris.Clark, r.david.murray, docs@python
2014-03-12 23:42:55Chris.Clarksetmessageid: <1394667775.82.0.140828297977.issue20903@psf.upfronthosting.co.za>
2014-03-12 23:42:55Chris.Clarklinkissue20903 messages
2014-03-12 23:42:55Chris.Clarkcreate