mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Handled EENVELOPE errors when generating magic link
refs https://github.com/TryGhost/Team/issues/1259 These errors are thrown by nodemailer and can occur when an invalid email address is used. Without special handling these cause a 500 error.
This commit is contained in:
parent
d6d4920fee
commit
2e7bb3e67e
@ -300,6 +300,11 @@ module.exports = class RouterController {
|
||||
res.writeHead(201);
|
||||
return res.end('Created.');
|
||||
} catch (err) {
|
||||
if (err.code === 'EENVELOPE') {
|
||||
logging.error(err);
|
||||
res.writeHead(400);
|
||||
return res.end('Bad Request.');
|
||||
}
|
||||
const statusCode = (err && err.statusCode) || 500;
|
||||
logging.error(err);
|
||||
res.writeHead(statusCode);
|
||||
|
Loading…
Reference in New Issue
Block a user