Add try catch to execution errors

This commit is contained in:
Volker Berlin 2018-03-24 17:32:48 +01:00
parent cf71920447
commit 3ab57b3804

View File

@ -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)
);