Handle the PortageException that can be raised from
authorZac Medico <zmedico@gentoo.org>
Sat, 13 Oct 2007 06:46:15 +0000 (06:46 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 13 Oct 2007 06:46:15 +0000 (06:46 -0000)
portage.mail.send_mail(). (trunk r8102)

svn path=/main/branches/2.1.2/; revision=8103

pym/elog_modules/mod_mail.py

index b8e17a51ad8f1c84041fad39e02ced032a262dc4..058faa7c0656ff5aa1743a97204f1145c5f023db 100644 (file)
@@ -4,6 +4,8 @@
 # $Id$
 
 import portage_mail, socket
+from portage_exception import PortageException
+from portage_util import writemsg
 
 def process(mysettings, cpv, logentries, fulltext):
        if mysettings.has_key("PORTAGE_ELOG_MAILURI"):
@@ -17,6 +19,9 @@ def process(mysettings, cpv, logentries, fulltext):
        mysubject = mysubject.replace("${HOST}", socket.getfqdn())
 
        mymessage = portage_mail.create_message(myfrom, myrecipient, mysubject, fulltext)
-       portage_mail.send_mail(mysettings, mymessage)
+       try:
+               portage_mail.send_mail(mysettings, mymessage)
+       except PortageException, e:
+               writemsg("%s\n" % str(e), noiselevel=-1)
 
        return