This commit is contained in:
AJ ONeal 2018-04-19 23:19:02 -06:00
parent 772dd22516
commit 825001bfb8
1 changed files with 4 additions and 5 deletions

View File

@ -4,8 +4,7 @@ var path = require('path');
var homeRe = new RegExp("^~(\\/|\\\\|\\" + path.sep + ")");
var re = /^[a-zA-Z0-9\.\-]+$/;
var punycode = require('punycode');
var PromiseA = require('bluebird');
var dns = PromiseA.promisifyAll(require('dns'));
var dnsResolveMxAsync = require('util').promisify(require('dns').resolveMx);
module.exports.attachCertInfo = function (results) {
// XXX Note: Parsing the certificate info comes at a great cost (~500kb)
@ -107,10 +106,10 @@ module.exports.testEmail = function (email) {
if (2 !== parts.length || !parts[0] || !parts[1]) {
err = new Error("malformed email address '" + email + "'");
err.code = 'E_EMAIL';
return PromiseA.reject(err);
return Promise.reject(err);
}
return dns.resolveMxAsync(parts[1]).then(function (records) {
return dnsResolveMxAsync(parts[1]).then(function (records) {
// records only returns when there is data
if (!records.length) {
throw new Error("sanity check fail: success, but no MX records returned");
@ -120,7 +119,7 @@ module.exports.testEmail = function (email) {
if ('ENODATA' === err.code) {
err = new Error("no MX records found for '" + parts[1] + "'");
err.code = 'E_EMAIL';
return PromiseA.reject(err);
return Promise.reject(err);
}
});
};