error callback on undefined hostname at multiple levels

This commit is contained in:
AJ ONeal 2016-04-09 12:02:57 -06:00
parent cc13d3d607
commit 9f31326a5a
1 changed files with 14 additions and 1 deletions

View File

@ -126,6 +126,11 @@ module.exports.create = function (opts) {
if (opts.debug) {
console.debug("[LEX] '" + hostname + "' is not registered, requesting approval");
}
if (!hostname) {
sniCb(new Error('[registerCert] no hostname'));
return;
}
opts.approveRegistration(hostname, function (err, args) {
@ -157,6 +162,11 @@ module.exports.create = function (opts) {
}
function fetch(hostname, sniCb) {
if (!hostname) {
sniCb(new Error('[sniCallback] [fetch] no hostname'));
return;
}
opts.letsencrypt.fetch({ domains: [hostname] }, function (err, certInfo) {
if (opts.debug) {
console.debug("[LEX] fetch from disk result '" + hostname + "':");
@ -184,7 +194,10 @@ module.exports.create = function (opts) {
var now = Date.now();
var certInfo = ipc[hostname];
if (!hostname) {
cb(new Error('[sniCallback] no hostname'));
return;
}
//
// No cert is available in cache.