make calls to remove resolve before returning #30

Open
Ghost wants to merge 1 commits from (deleted):remove-logic into master
1 changed files with 25 additions and 43 deletions

68
acme.js
View File

@ -774,50 +774,32 @@ ACME._postChallenge = function(me, options, kid, auth) {
// REMOVE DNS records as soon as the state is non-processing // REMOVE DNS records as soon as the state is non-processing
// (valid or invalid or other) // (valid or invalid or other)
try {
options.challenges[auth.type]
.remove({ challenge: auth })
.catch(function(err) {
err.action = 'challenge_remove';
err.altname = auth.altname;
err.type = auth.type;
ACME._notify(me, options, 'error', err);
});
} catch (e) {}
if ('valid' === resp.body.status) {
if (me.debug) {
console.debug('poll: valid');
}
return resp.body;
}
var errmsg; var errmsg;
if (!resp.body.status) { return options.challenges[auth.type]
errmsg = .remove({ challenge: auth })
"[ACME.js] (E_STATE_EMPTY) empty challenge state for '" + .then((res) => {
altname + if ("valid" === resp.body.status) {
"':" + if (me.debug) {
JSON.stringify(resp.body); console.debug("poll: valid");
} else if ('invalid' === resp.body.status) { }
errmsg = return resp.body;
"[ACME.js] (E_STATE_INVALID) challenge state for '" + }
altname + return Promise.reject("status not valid");
"': '" + })
//resp.body.status + .catch(function (err) {
JSON.stringify(resp.body) + if (!resp.body.status) {
"'"; errmsg = "[ACME.js] (E_STATE_EMPTY) empty challenge state for '" + altname + "':" + JSON.stringify(resp.body);
} else { } else if ("invalid" === resp.body.status) {
errmsg = errmsg = "[ACME.js] (E_STATE_INVALID) challenge state for '" + altname + "': '" + JSON.stringify(resp.body) + "'";
"[ACME.js] (E_STATE_UKN) challenge state for '" + } else {
altname + errmsg = "[ACME.js] (E_STATE_UKN) challenge state for '" + altname + "': '" + resp.body.status + "'";
"': '" + }
resp.body.status + err.action = "challenge_remove";
"'"; err.altname = auth.altname;
} err.type = auth.type;
ACME._notify(me, options, "error", err);
return Promise.reject(new Error(errmsg)); return Promise.reject(new Error(errmsg));
});
} }
function transformError(e) { function transformError(e) {