Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add debug output and missing exception handlers to fix #459 #460

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

madmas
Copy link

@madmas madmas commented May 6, 2020

add debug outout and exception handling fix to get rid of over-and-over sent notifications.

I think esp. the changes to line 410 helped to fix the issue.

@kesselb
Copy link
Contributor

kesselb commented Jun 17, 2020

How does logException fixes something? Mind to share $e->getMessage() to see why sending the email failed?

@madmas
Copy link
Author

madmas commented Jun 24, 2020

Hi @kesselb , sorry, I switched the lines, I think the actual fix is below, in line 415. 410 of course only helps in regard of debugging ;-)

Signed-off-by: Markus Schlichting <markus.schlichting@karakun.com>
@kesselb
Copy link
Contributor

kesselb commented Jun 24, 2020

Mind to share the exception? Also you overwrite the actual exception message. That makes it harder to debug.

Copy link
Contributor

@kesselb kesselb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced. Right now the error handling code fails and the original exception message is replaced with a generic error message.

lib/MailQueueHandler.php Outdated Show resolved Hide resolved
lib/MailQueueHandler.php Outdated Show resolved Hide resolved
@@ -405,6 +407,12 @@ protected function sendEmailToUser($userName, $email, $lang, $timezone, $maxTime
try {
$this->mailer->send($message);
} catch (\Exception $e) {
$this->logger->logException($e, [
'message' => 'Failed sending email to user "{user}"',
'user' => $user,
Copy link
Contributor

@kesselb kesselb Jun 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log the exception with $this->logger->logException($e); and log a additional warning $this->logger->warning('Failed to send notification email for user {user}', ['user' => $userName]);. You cannot use $user because it's a IUser object. Ah that might work as the normalizer will format it. I would still prefer the $userName ;)

change the glue for implode from | to ,

Co-authored-by: kesselb <mail@danielkesselberg.de>
@madmas
Copy link
Author

madmas commented Jun 26, 2020

I'm not convinced. Right now the error handling code fails and the original exception message is replaced with a generic error message.

My experience was vice versa - with the output I added with shown here, I got much more details.
I cannot share the exception as after implementing this, I don't see them happen on my system anymore....

@kesselb
Copy link
Contributor

kesselb commented Jun 26, 2020

We still don't know why sending the notification failed in the first place. This is fixing symptoms not problems 😟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants