From f21ddb2131d334ab1631602de1e75f8a7b2e60cf Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 20 Jun 2019 08:09:17 +0200 Subject: [PATCH] crypto: move _impl call out of handleError funct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit moves the _impl function call out of the handleError function, which now only takes in an object as its parameter. PR-URL: https://github.com/nodejs/node/pull/28318 Reviewed-By: Yongsheng Zhang Reviewed-By: Benjamin Gruenbaum Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- lib/internal/crypto/keygen.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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