mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +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;
|
||||
|
||||
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)
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user