mirror of
https://github.com/eleith/emailjs.git
synced 2024-07-05 20:10:37 +00:00
Extend error message for bad command response
Include the error message sent by the server in the SMTPError message if available.
This commit is contained in:
parent
b2c5f09d10
commit
956c85de0e
12
smtp/smtp.js
12
smtp/smtp.js
@ -198,9 +198,15 @@ SMTP.prototype = {
|
||||
if (err) {
|
||||
caller(callback, err);
|
||||
} else {
|
||||
if (codes.indexOf(Number(msg.code)) != -1) caller(callback, err, msg.data, msg.message);
|
||||
|
||||
else caller(callback, SMTPError("bad response on command '" + cmd.split(' ')[0] + "'", SMTPError.BADRESPONSE, null, msg.data));
|
||||
if (codes.indexOf(Number(msg.code)) != -1) {
|
||||
caller(callback, err, msg.data, msg.message);
|
||||
} else {
|
||||
var errorMessage = "bad response on command '" + cmd.split(' ')[0] + "'";
|
||||
if (msg.message) {
|
||||
errorMessage += ': ' + msg.message;
|
||||
}
|
||||
caller(callback, SMTPError(errorMessage, SMTPError.BADRESPONSE, null, msg.data));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user