Skip to content
Permalink
Browse files

crypto: move _impl call out of handleError funct

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 Jun 20, 2019
1 parent 558e9cf commit f21ddb2131d334ab1631602de1e75f8a7b2e60cf
Showing with 3 additions and 4 deletions.
  1. +3 −4 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

0 comments on commit f21ddb2

Please sign in to comment.
You can’t perform that action at this time.