handle setChallenge failure

This commit is contained in:
AJ ONeal 2016-02-11 15:22:41 -05:00
parent 7eace7e37e
commit e0202a559e
1 changed files with 14 additions and 2 deletions

View File

@ -166,7 +166,18 @@ module.exports.create = function (deps) {
options.setChallenge(state.domain, challenge.token, keyAuthorization, challengeDone);
function challengeDone() {
function challengeDone(err) {
if (err) {
console.error('[letiny-core] setChallenge Error:');
console.error(err && err.stack || err);
ensureValidation(err, null, null, function () {
options.removeChallenge(state.domain, challenge.token, function () {
// ignore
});
});
return;
}
state.acme.post(state.responseUrl, {
resource:'challenge',
keyAuthorization:keyAuthorization
@ -193,7 +204,8 @@ module.exports.create = function (deps) {
if (err || Math.floor(res.statusCode/100)!==2) {
unlink();
return handleErr(err, 'Authorization status request failed ('+res.statusCode+')');
return handleErr(err, 'Authorization status request failed ('
+ (res && res.statusCode || err.code || err.message || err) + ')');
}
authz=body;