Skip to content

Commit

Permalink
fix(certs): Show a proper error response for failed ACME validation r…
Browse files Browse the repository at this point in the history
…equests
  • Loading branch information
andris9 committed Oct 18, 2024
1 parent 3f967a9 commit 71dfeba
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/routes-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -9197,11 +9197,17 @@ return payload;`
try {
challenge = await h.certs.routeHandler(domain, request.params.token);
if (!challenge) {
throw new Error('Empty challenge');
throw new Error('Challenge not found for the provided token and domain');
}
} catch (err) {
let error = Boom.boomify(err, { statusCode: err.statusCode || 500 });
throw error;
return h
.response(
`Request failed: ${err.message}
Domain: ${JSON.stringify(domain)}
Token: ${JSON.stringify(request.params.token)}`
)
.type('text/plain')
.code(err.statusCode || 500);
}

const response = h.response('success');
Expand Down

0 comments on commit 71dfeba

Please sign in to comment.