Add logging for approveDomains errors. Addresses https://git.coolaj86.com/coolaj86/greenlock-express.js/issues/8
This commit is contained in:
parent
4b448fdf6b
commit
6c054cf241
21
index.js
21
index.js
|
@ -273,6 +273,7 @@ LE.create = function (le) {
|
||||||
log(le.debug, 'le.getCertificates called for', domain, 'with certs for', certs && certs.altnames || 'NONE');
|
log(le.debug, 'le.getCertificates called for', domain, 'with certs for', certs && certs.altnames || 'NONE');
|
||||||
var opts = { domain: domain, domains: certs && certs.altnames || [ domain ] };
|
var opts = { domain: domain, domains: certs && certs.altnames || [ domain ] };
|
||||||
|
|
||||||
|
try {
|
||||||
le.approveDomains(opts, certs, function (_err, results) {
|
le.approveDomains(opts, certs, function (_err, results) {
|
||||||
if (_err) {
|
if (_err) {
|
||||||
log(le.debug, 'le.approveDomains called with error', _err);
|
log(le.debug, 'le.approveDomains called with error', _err);
|
||||||
|
@ -294,15 +295,31 @@ LE.create = function (le) {
|
||||||
promise = le.core.certificates.getAsync(results.options);
|
promise = le.core.certificates.getAsync(results.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return promise.then(function (certs) { cb(null, certs); }, cb);
|
return promise.then(function (certs) { cb(null, certs); }, function (e) {
|
||||||
|
if (le.debug) { console.debug("Error"); console.debug(e); }
|
||||||
|
cb(e);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
} catch(e) {
|
||||||
|
console.error("[ERROR] Something went wrong in approveDomains:");
|
||||||
|
console.error(e);
|
||||||
|
console.error("BUT WAIT! Good news: It's probably your fault, so you can probably fix it.");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
le.sni = le.sni || require('le-sni-auto');
|
le.sni = le.sni || require('le-sni-auto');
|
||||||
if (le.sni.create) {
|
if (le.sni.create) {
|
||||||
le.sni = le.sni.create(le);
|
le.sni = le.sni.create(le);
|
||||||
}
|
}
|
||||||
le.tlsOptions.SNICallback = le.sni.sniCallback;
|
le.tlsOptions.SNICallback = function (domain, cb) {
|
||||||
|
try {
|
||||||
|
le.sni.sniCallback(domain, cb);
|
||||||
|
} catch(e) {
|
||||||
|
console.error("[ERROR] Something went wrong in the SNICallback:");
|
||||||
|
console.error(e);
|
||||||
|
cb(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if (!le.tlsOptions.key || !le.tlsOptions.cert) {
|
if (!le.tlsOptions.key || !le.tlsOptions.cert) {
|
||||||
le.tlsOptions = require('localhost.daplie.me-certificates').merge(le.tlsOptions);
|
le.tlsOptions = require('localhost.daplie.me-certificates').merge(le.tlsOptions);
|
||||||
|
|
Loading…
Reference in New Issue