Added error handler details.

This commit is contained in:
Martin Heidegger 2016-02-15 23:06:41 +09:00
parent 6a8592994e
commit 8ec66c2a1f
1 changed files with 12 additions and 2 deletions

View File

@ -200,7 +200,7 @@ module.exports.create = function (deps) {
}
function ensureValidation(err, res, body, unlink) {
var authz;
var authz, challengesState;
if (err || Math.floor(res.statusCode/100)!==2) {
unlink();
@ -235,7 +235,17 @@ module.exports.create = function (deps) {
nextDomain();
} else if (authz.status==='invalid') {
unlink();
return handleErr(null, 'The CA was unable to validate the file you provisioned: ' + authz.detail, body);
challengesState = state.challenges.map(function (challenge) {
var result = ' - ' + challenge.uri + ' [' + challenge.status + ']';
if (result.error) {
result += '\n ' + result.error.detail;
}
return result;
}).join('\n');
return handleErr(null,
'The CA was unable to validate the file you provisioned. '
+ (authz.detail ? 'Details: ' + authz.detail : '')
+ (challengesState ? '\n' + challengesState : ''), body);
} else {
unlink();
return handleErr(null, 'CA returned an authorization in an unexpected state' + authz.detail, authz);