diff options
-rw-r--r-- | packages/utils/CHANGELOG.json | 9 | ||||
-rw-r--r-- | packages/utils/src/promisify.ts | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index fb85c4174..d84e32dd2 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "version": "3.0.0", + "changes": [ + { + "note": "Make `promisify` resolve when the callback error is undefined.", + "pr": 1501 + } + ] + }, + { "version": "2.1.1", "changes": [ { diff --git a/packages/utils/src/promisify.ts b/packages/utils/src/promisify.ts index 29d626b61..e82251a0f 100644 --- a/packages/utils/src/promisify.ts +++ b/packages/utils/src/promisify.ts @@ -10,7 +10,7 @@ export function promisify<T>(originalFn: (...args: any[]) => void, thisArg?: any const promisifiedFunction = async (...callArgs: any[]): Promise<T> => { return new Promise<T>((resolve, reject) => { const callback = (err: Error | null, data?: T) => { - _.isNull(err) ? resolve(data) : reject(err); + _.isNull(err) || _.isUndefined(err) ? resolve(data) : reject(err); }; originalFn.apply(thisArg, [...callArgs, callback]); }); |