From 8ec66c2a1fc165fb32d00f85ea6e6e091773532b Mon Sep 17 00:00:00 2001 From: Martin Heidegger Date: Mon, 15 Feb 2016 23:06:41 +0900 Subject: [PATCH] Added error handler details. --- lib/get-certificate.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/get-certificate.js b/lib/get-certificate.js index 53a11fc..cd67b7c 100644 --- a/lib/get-certificate.js +++ b/lib/get-certificate.js @@ -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);