mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Merge pull request #5243 from jaswilli/mail-errors
Check error object before dereference
This commit is contained in:
commit
79ff297490
1 changed files with 9 additions and 2 deletions
|
@ -92,7 +92,8 @@ GhostMailer.prototype.send = function (message) {
|
|||
|
||||
response.statusHandler.once('failed', function (data) {
|
||||
var reason = 'Email Error: Failed sending email';
|
||||
if (data.error.errno === 'ENOTFOUND') {
|
||||
|
||||
if (data.error && data.error.errno === 'ENOTFOUND') {
|
||||
reason += ': there is no mail server at this address: ' + data.domain;
|
||||
}
|
||||
reason += '.';
|
||||
|
@ -100,7 +101,13 @@ GhostMailer.prototype.send = function (message) {
|
|||
});
|
||||
|
||||
response.statusHandler.once('requeue', function (data) {
|
||||
return reject(new Error('Email Error: message was not sent, requeued. Probably will not be sent. :( \nMore info: ' + data.error.message));
|
||||
var errorMessage = 'Email Error: message was not sent, requeued. Probably will not be sent. :(';
|
||||
|
||||
if (data.error && data.error.message) {
|
||||
errorMessage += '\nMore info: ' + data.error.message;
|
||||
}
|
||||
|
||||
return reject(new Error(errorMessage));
|
||||
});
|
||||
|
||||
response.statusHandler.once('sent', function () {
|
||||
|
|
Loading…
Reference in a new issue