From 3b119bd81aafc9f167314ecc4a6648d36d08438f Mon Sep 17 00:00:00 2001 From: Hamza Ali Date: Sun, 21 Mar 2021 20:48:05 +0700 Subject: [PATCH] fix(js): do callback on correct type when go compilation fails --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index c84b92c..d12ff1c 100644 --- a/src/index.js +++ b/src/index.js @@ -58,11 +58,11 @@ module.exports = function (source) { } - const res = await execFile("go", ["build", "-o", outFile, parent], opts) + const result = await execFile("go", ["build", "-o", outFile, parent], opts) .then(() => true) .catch(e => e); - if (res instanceof Error) { - return cb(e); + if (result instanceof Error) { + return cb(result); } found = await fs.access(wasmSavePath).then(() => true).catch(() => false);