~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smtp_connection.py

  • Committer: Adeodato Simó
  • Date: 2007-06-20 00:39:33 UTC
  • mto: (2547.1.1 Aaron's integration)
  • mto: This revision was merged to the branch mainline in revision 2548.
  • Revision ID: dato@net.com.org.es-20070620003933-cjj1lq1lqgav5gm6
Don't use BzrCommandError in non-UI code; create and use an SMTPError
exception instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import smtplib
21
21
 
22
22
from bzrlib import ui
23
 
from bzrlib.errors import BzrCommandError, NoDestinationAddress
 
23
from bzrlib.errors import NoDestinationAddress, SMTPError
24
24
 
25
25
 
26
26
class SMTPConnection(object):
110
110
            self._connect()
111
111
            self._connection.sendmail(from_email, to_emails, message.as_string())
112
112
        except smtplib.SMTPRecipientsRefused, e:
113
 
            raise BzrCommandError('SMTP server refused recipient: %d %s' 
114
 
                % e.recipients.values()[0])
 
113
            raise SMTPError('server refused recipient: %d %s' %
 
114
                    e.recipients.values()[0])
115
115
        except smtplib.SMTPResponseException, e:
116
 
            raise BzrCommandError('SMTP error: %d %s' % (e.smtp_code,
117
 
                e.smtp_error))
 
116
            raise SMTPError('%d %s' % (e.smtp_code, e.smtp_error))
118
117
        except smtplib.SMTPException, e:
119
 
            raise BzrCommandError('SMTP error: ' + str(e))
 
118
            raise SMTPError(str(e))