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 <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • 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.