greenlock.js-ARCHIVED/errors.js

59 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-10-20 08:51:19 +00:00
'use strict';
var E = module.exports;
function create(code, msg) {
2019-10-31 22:26:18 +00:00
E[code] = function(ctx, msg2) {
var err = new Error(msg);
err.code = code;
err.context = ctx;
if (msg2) {
err.message += ': ' + msg2;
}
/*
2019-10-20 08:51:19 +00:00
Object.keys(extras).forEach(function(k) {
if ('message' === k) {
err.message += ': ' + extras[k];
} else {
err[k] = extras[k];
}
});
*/
2019-10-31 22:26:18 +00:00
return err;
};
2019-10-20 08:51:19 +00:00
}
// TODO open issues and link to them as the error url
create(
2019-10-31 22:26:18 +00:00
'NO_MAINTAINER',
'please supply `maintainerEmail` as a contact for security and critical bug notices'
2019-10-20 08:51:19 +00:00
);
create(
2019-10-31 22:26:18 +00:00
'BAD_ORDER',
'altnames should be in deterministic order, with subject as the first altname'
2019-10-20 08:51:19 +00:00
);
create('NO_SUBJECT', 'no certificate subject given');
create(
2019-10-31 22:26:18 +00:00
'NO_SUBSCRIBER',
'please supply `subscriberEmail` as a contact for failed renewal and certificate revocation'
2019-10-20 08:51:19 +00:00
);
create(
2019-10-31 22:26:18 +00:00
'INVALID_SUBSCRIBER',
'`subscriberEmail` is not a valid address, please check for typos'
2019-10-20 08:51:19 +00:00
);
create(
2019-10-31 22:26:18 +00:00
'INVALID_HOSTNAME',
'valid hostnames must be restricted to a-z0-9_.- and contain at least one "."'
2019-10-20 08:51:19 +00:00
);
create(
2019-10-31 22:26:18 +00:00
'INVALID_DOMAIN',
'one or more domains do not exist on public DNS SOA record'
2019-10-20 08:51:19 +00:00
);
create(
2019-10-31 22:26:18 +00:00
'NOT_UNIQUE',
'found duplicate domains, or a subdomain that overlaps a wildcard'
2019-10-20 08:51:19 +00:00
);
// exported for testing only
E._create = create;