On Oct 7, 2009, at 12:23 PM, Matthew Dixon Cowles wrote:

In my opinion, the email module should never raise an exception as a
result of working with a malformed message. Though it should
certainly make the information that a message was malformed available
for the calling program to check.

That is, I think that it's extremely unlikely that the calling
program wants to blow up as a result of a malformed message. Very
probably, it wants to make what sense of the message that it can. The
number of ways in which a message can be malformed is pretty large
and just how (and when, as has been mentioned) any particular error
will cause problems for the module is really a matter that's internal
to the module. The module's user shouldn't have to say, "Over here I
have to trap UnicodeErrors and over there I have to trap IndexErrors".

I've said it before: I complete agree with you, at least for parsing. The big problem in my experience with Mailman is that you're sort of too upside down in the application to do anything about parsing errors when they occur except log it and shunt it. And that's just not very helpful.

However, when crafting messages from scratch, I think it /would/ be okay to raise exceptions when something is done wrong, because the application has more control over the data and is in a position to either handle the problem or for the bug to be fixed <wink>. In this case, complaining early is much better than say failing in the generator.

-Barry

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Email-SIG mailing list
[email protected]
Your options: 
http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com

Reply via email to