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

svn path=/main/trunk/; revision=8102

pym/portage/elog/mod_mail.py

index c9fa5b5639b1bb874db7c4217ae1ba8ac6b0a09d..922ea08465edb474f9ada34af0b1fc9c5240cc1e 100644 (file)
@@ -4,6 +4,8 @@
 # $Id$
 
 import portage.mail, socket
+from portage.exception import PortageException
+from portage.util import writemsg
 
 def process(mysettings, key, logentries, fulltext):
        if mysettings.has_key("PORTAGE_ELOG_MAILURI"):
@@ -32,6 +34,9 @@ def process(mysettings, key, logentries, fulltext):
        mysubject = mysubject.replace("${ACTION}", action)
 
        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