From 3ab57b380484290ba56cd1d16dd444a553f8e1de Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sat, 24 Mar 2018 17:32:48 +0100 Subject: [PATCH] Add try catch to execution errors --- test/de/inetsoftware/jwebassembly/nodetest.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/de/inetsoftware/jwebassembly/nodetest.js b/test/de/inetsoftware/jwebassembly/nodetest.js index e892ed1..5c9cf5c 100644 --- a/test/de/inetsoftware/jwebassembly/nodetest.js +++ b/test/de/inetsoftware/jwebassembly/nodetest.js @@ -16,8 +16,15 @@ var dependencies = { }; dependencies["global.Math"] = Math; +function callExport(instance) { + try{ + console.log( instance.exports[process.argv[2]]( ...process.argv.slice(3) ) ); + }catch(err){ + console.log(err) + } +} instantiate( ret, dependencies ).then( - instance => console.log( instance.exports[process.argv[2]]( ...process.argv.slice(3) ) ), + instance => callExport(instance), reason => console.log(reason) );