diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2011-12-25 11:03:30 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2011-12-25 15:38:19 +0100 |
commit | 141573771b9a36718346265c9aaca3f0a80c0396 (patch) | |
tree | c64e57d86a4a1c79dd4eaa5ababeb1968c0cd25f /alot/account.py | |
parent | c97257fc02e5b0ac84f006f2187fed753358dcb7 (diff) |
Use exceptions for error handling in SendmailAccount.send_mail
Diffstat (limited to 'alot/account.py')
-rw-r--r-- | alot/account.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/alot/account.py b/alot/account.py index 6eb9f099..8d76a60b 100644 --- a/alot/account.py +++ b/alot/account.py @@ -10,6 +10,7 @@ from urlparse import urlparse import helper +class SendingMailFailed(RuntimeError): pass class Account(object): """ @@ -121,8 +122,7 @@ class Account(object): :param mail: the mail to send :type mail: :class:`email.message.Message` or string - :returns: None if successful and a string with the reason - for failure otherwise. + :raises: :class:`alot.account.SendingMailFailed` if an error occured """ return 'not implemented' @@ -143,9 +143,8 @@ class SendmailAccount(Account): cmdlist = shlex.split(self.cmd.encode('utf-8', errors='ignore')) out, err, retval = helper.call_cmd(cmdlist, stdin=mail.as_string()) if err: - return err + '. sendmail_cmd set to: %s' % self.cmd + raise SendingMailFailed('%s. sendmail_cmd set to: %s' % (err, self.cmd)) self.store_sent_mail(mail) - return None class AccountManager(object): |