aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2019-01-10 10:26:18 +0800
committerfragosti <francesco.agosti93@gmail.com>2019-01-10 10:26:18 +0800
commit7a114a6ef182b70a2f2b221cce2423aa1fffff9e (patch)
treef952ff7414c14ae86342ed92e3b51b939df73101
parent87c287a5e26e89ee25dd43793415d00d4ddfd5fa (diff)
downloaddexon-sol-tools-7a114a6ef182b70a2f2b221cce2423aa1fffff9e.tar
dexon-sol-tools-7a114a6ef182b70a2f2b221cce2423aa1fffff9e.tar.gz
dexon-sol-tools-7a114a6ef182b70a2f2b221cce2423aa1fffff9e.tar.bz2
dexon-sol-tools-7a114a6ef182b70a2f2b221cce2423aa1fffff9e.tar.lz
dexon-sol-tools-7a114a6ef182b70a2f2b221cce2423aa1fffff9e.tar.xz
dexon-sol-tools-7a114a6ef182b70a2f2b221cce2423aa1fffff9e.tar.zst
dexon-sol-tools-7a114a6ef182b70a2f2b221cce2423aa1fffff9e.zip
fix: account for undefined errors in promisify, not only null
-rw-r--r--packages/utils/src/promisify.ts2
1 files changed, 1 insertions, 1 deletions
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]);
});