Actions
Defect #28874
closedMailHandler does not log exceptions caught
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Duplicate
Affected version:
Description
Issue:
If a locally unhandled exception is raised when receiving a mail, the error is not logged.
How to repro:
1. Add the line
raise "An error occurred"
as the first line of the receive method
2. Run the rake task
rake redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com port=993 move_on_success=Success move_on_failure=Failure username=***** password=*****
on a mailbox which has at least one unread mail in the mailbox
3. Check the redmine log
Result:
D, [2018-05-24T17:25:53.647960 #16786] DEBUG -- : Receiving message 21674
D, [2018-05-24T17:25:53.648109 #16786] DEBUG -- : Message 21674 can not be processed
Expected result:
D, [2018-05-24T17:25:53.647960 #16786] DEBUG -- : Receiving message 21674
E, [2018-05-24T17:25:53.648076 #16786] ERROR -- : MailHandler: an unexpected error occurred when receiving email: An error has occured
D, [2018-05-24T17:25:53.648109 #16786] DEBUG -- : Message 21674 can not be processed
Suggested fix: define logger as self.logger instead as just logger in the MailHandler class
Related issues
Actions