diff --git a/lib/internal/crypto/keygen.js b/lib/internal/crypto/keygen.js index f646f436f7678a..0a4bde77fa369b 100644 --- a/lib/internal/crypto/keygen.js +++ b/lib/internal/crypto/keygen.js @@ -60,7 +60,7 @@ function generateKeyPair(type, options, callback) { callback.call(wrap, null, pubkey, privkey); }; - handleError(impl, wrap); + handleError(impl(wrap)); } Object.defineProperty(generateKeyPair, customPromisifyArgs, { @@ -70,11 +70,10 @@ Object.defineProperty(generateKeyPair, customPromisifyArgs, { function generateKeyPairSync(type, options) { const impl = check(type, options); - return handleError(impl); + return handleError(impl()); } -function handleError(impl, wrap) { - const ret = impl(wrap); +function handleError(ret) { if (ret === undefined) return; // async