Merge lp:~stevenk/launchpad/catch-incomingemailerror into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Steve Kowalik |
Approved revision: | no longer in the source branch. |
Merged at revision: | 15990 |
Proposed branch: | lp:~stevenk/launchpad/catch-incomingemailerror |
Merge into: | lp:launchpad |
Diff against target: |
93 lines (+11/-23) 2 files modified
lib/lp/services/mail/incoming.py (+6/-12) lib/lp/services/mail/tests/test_incoming.py (+5/-11) |
To merge this branch: | bzr merge lp:~stevenk/launchpad/catch-incomingemailerror |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ian Booth (community) | Approve | ||
Review via email: mp+125416@code.launchpad.net |
Commit message
Also catch IncomingEmailError as well as InvalidSignature in handle_one_mail so the sender gets a nice mail back, rather than an OOPS.
Description of the change
In the incoming mail handler, handle_one_mail, we call a function called authenticateEmail which tries to work out based on DKIM or GPG signature who the principal is. This is called inside a try block and the two exceptions InvalidSignature or InactiveAccount are handled and do not cause an OOPS. The problem is, authenticateEmail can also raise an IncomingEmailError, which isn't caught, and so will oops.
I have changed the except block to treat InvalidSignature or IncomingEmailError as the same. I can not see a way to test this, since it would require sending a mail with a plausible out of date timestamp. The pieces themselves are tested, there just isn't a way to test everything together.
Perform some cleanup, mostly whitespace.