bugfix: throw error when key gen entirely fails

This commit is contained in:
AJ ONeal 2019-06-03 01:17:25 -06:00
parent be782fbdfa
commit 92463a6ec2
2 changed files with 3 additions and 4 deletions

View File

@ -48,11 +48,10 @@ module.exports = function (bitlen, exp) {
try { try {
return require('./generate-privkey-forge.js')(bitlen, exp); return require('./generate-privkey-forge.js')(bitlen, exp);
} catch(e) { } catch(e) {
if (e.code !== 'MODULE_NOT_FOUND') {
throw e;
}
console.error("[ERROR] rsa-compat: could not generate a private key."); console.error("[ERROR] rsa-compat: could not generate a private key.");
console.error("None of crypto.generateKeyPair, ursa, nor node-forge are present"); console.error("None of crypto.generateKeyPair, ursa, nor node-forge are present");
console.error("");
throw e;
} }
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "rsa-compat", "name": "rsa-compat",
"version": "2.0.6", "version": "2.0.7",
"engines": { "engines": {
"node": ">=10.12" "node": ">=10.12"
}, },