Merge pull request #3 from martinheidegger/detailed-error-message

Added error handler details.
This commit is contained in:
AJ ONeal 2016-02-15 08:46:08 -07:00
commit 3babc27847
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) { function ensureValidation(err, res, body, unlink) {
var authz; var authz, challengesState;
if (err || Math.floor(res.statusCode/100)!==2) { if (err || Math.floor(res.statusCode/100)!==2) {
unlink(); unlink();
@ -235,7 +235,17 @@ module.exports.create = function (deps) {
nextDomain(); nextDomain();
} else if (authz.status==='invalid') { } else if (authz.status==='invalid') {
unlink(); 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 { } else {
unlink(); unlink();
return handleErr(null, 'CA returned an authorization in an unexpected state' + authz.detail, authz); return handleErr(null, 'CA returned an authorization in an unexpected state' + authz.detail, authz);