From 7a114a6ef182b70a2f2b221cce2423aa1fffff9e Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 9 Jan 2019 18:26:18 -0800 Subject: fix: account for undefined errors in promisify, not only null --- packages/utils/src/promisify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') 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(originalFn: (...args: any[]) => void, thisArg?: any const promisifiedFunction = async (...callArgs: any[]): Promise => { return new Promise((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]); }); -- cgit v1.2.3 From b639843115547fc3d259fcfb98599a16187b3d07 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 9 Jan 2019 18:31:23 -0800 Subject: chore: changelog update --- packages/utils/CHANGELOG.json | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'packages') 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,4 +1,13 @@ [ + { + "version": "3.0.0", + "changes": [ + { + "note": "Make `promisify` resolve when the callback error is undefined.", + "pr": 1501 + } + ] + }, { "version": "2.1.1", "changes": [ -- cgit v1.2.3