mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
Add try catch to execution errors
This commit is contained in:
parent
cf71920447
commit
3ab57b3804
@ -16,8 +16,15 @@ var dependencies = {
|
|||||||
};
|
};
|
||||||
dependencies["global.Math"] = Math;
|
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(
|
instantiate( ret, dependencies ).then(
|
||||||
instance => console.log( instance.exports[process.argv[2]]( ...process.argv.slice(3) ) ),
|
instance => callExport(instance),
|
||||||
reason => console.log(reason)
|
reason => console.log(reason)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user