Skip to content

Commit

Permalink
crypto: move _impl call out of handleError funct
Browse files Browse the repository at this point in the history
This commit moves the _impl function call out of the handleError
function, which now only takes in an object as its parameter.

PR-URL: #28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
danbev authored and targos committed Jul 2, 2019
1 parent 558e9cf commit f21ddb2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/internal/crypto/keygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand All @@ -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

Expand Down

0 comments on commit f21ddb2

Please sign in to comment.