acme.js/errors.js

82 lines
2.2 KiB
JavaScript
Raw Normal View History

2019-10-25 00:49:42 +00:00
'use strict';
var E = module.exports;
2020-07-28 21:53:50 +00:00
E.NO_SUITABLE_CHALLENGE = function (domain, challenges, presenters) {
2019-10-25 00:49:42 +00:00
// Bail with a descriptive message if no usable challenge could be selected
// For example, wildcards require dns-01 and, if we don't have that, we have to bail
var enabled = presenters.join(', ') || 'none';
var suitable =
challenges
2020-07-28 21:53:50 +00:00
.map(function (r) {
2019-10-25 00:49:42 +00:00
return r.type;
})
.join(', ') || 'none';
return new Error(
"None of the challenge types that you've enabled ( " +
enabled +
' )' +
" are suitable for validating the domain you've selected (" +
domain +
').' +
' You must enable one of ( ' +
suitable +
' ).'
);
};
2020-07-28 21:53:50 +00:00
E.UNHANDLED_ORDER_STATUS = function (options, domains, resp) {
2019-10-25 00:49:42 +00:00
return new Error(
"Didn't finalize order: Unhandled status '" +
resp.body.status +
"'." +
' This is not one of the known statuses...\n' +
"Requested: '" +
options.domains.join(', ') +
"'\n" +
"Validated: '" +
domains.join(', ') +
"'\n" +
JSON.stringify(resp.body, null, 2) +
'\n\n' +
'Please open an issue at https://git.rootprojects.org/root/acme.js'
);
};
2020-07-28 21:53:50 +00:00
E.DOUBLE_READY_ORDER = function (options, domains, resp) {
2019-10-25 00:49:42 +00:00
return new Error(
"Did not finalize order: status 'ready'." +
" Hmmm... this state shouldn't be possible here. That was the last state." +
" This one should at least be 'processing'.\n" +
"Requested: '" +
options.domains.join(', ') +
"'\n" +
"Validated: '" +
domains.join(', ') +
"'\n" +
JSON.stringify(resp.body, null, 2) +
'\n\n' +
'Please open an issue at https://git.rootprojects.org/root/acme.js'
);
};
2020-07-28 21:53:50 +00:00
E.ORDER_INVALID = function (options, domains, resp) {
2019-10-25 00:49:42 +00:00
return new Error(
"Did not finalize order: status 'invalid'." +
' Best guess: One or more of the domain challenges could not be verified' +
' (or the order was canceled).\n' +
"Requested: '" +
options.domains.join(', ') +
"'\n" +
"Validated: '" +
domains.join(', ') +
"'\n" +
JSON.stringify(resp.body, null, 2)
);
};
2020-07-28 21:53:50 +00:00
E.NO_AUTHORIZATIONS = function (options, resp) {
2019-10-25 00:49:42 +00:00
return new Error(
"[acme-v2.js] authorizations were not fetched for '" +
options.domains.join() +
"':\n" +
JSON.stringify(resp.body)
);
};