Chris Clark added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20903>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to