[Tutor] error reporting disreputable
Daniel Coughlin
kauphlyn@speakeasy.org
Tue, 22 Jan 2002 12:21:24 -0800 (PST)
On Tue, 22 Jan 2002, kirk Bailey wrote:
> ok, I included code to report errors to the postmaster. Lookee:
> try:
> server.sendmail(from_addr, to_addr, msg) # 400
> send envlope and msg!
> except Exception, e:
> from_addr2="TLpost.py@"+domainname
> to_addr2="postmaster@"+domainname
> msg2="To: "+to_addr2+CRLF
> msg2=msg2+"From: "+from_addr2+CRLF
> msg2=msg2+"Subject: ERROR REPORT for
> list"+listname+CRLF+CRLF
> msg2=msg2+"There was an error when serving list
> "+listname+"."+CRLF
> msg2=msg2+"The returned error was:"+CRLF
> msg2=msg2+e+CRLF
^
One possible reason why this might fail is because you are adding an instance to
a string. Try
msg2=msg2+str(e)+CRLF
or you could try putting the block of code under the above except statement in
its own
try, except control structure.
Hope this helps
Daniel