mirror of
https://github.com/wassname/talk.git
synced 2026-07-05 21:07:58 +08:00
Don't crash on email address lookup failure
If for whatever reason an email job gets queued for a user with no email, an exception is thrown on the getEmailAddress() step. This exception was never handled and therefore the app crashed. Handle it and log instead..
This commit is contained in:
+6
-1
@@ -111,7 +111,12 @@ const processJob = transport => async ({ id, data }, done) => {
|
||||
const { message } = data;
|
||||
|
||||
// Get the email address from the job data.
|
||||
message.to = await getEmailAddress(data);
|
||||
try {
|
||||
message.to = await getEmailAddress(data);
|
||||
} catch (err) {
|
||||
logger.error({ err }, 'Failed to get user email address to send mail');
|
||||
return done(err);
|
||||
}
|
||||
|
||||
const log = logger.child({ jobID: id });
|
||||
log.info('Starting to send mail');
|
||||
|
||||
Reference in New Issue
Block a user