mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Add try catch to execution errors
This commit is contained in:
parent
92a878b5bf
commit
1b6d1b7ecc
@ -14,8 +14,15 @@ var dependencies = {
|
|||||||
};
|
};
|
||||||
dependencies["global.Math"] = Math;
|
dependencies["global.Math"] = Math;
|
||||||
|
|
||||||
|
function callExport(instance) {
|
||||||
|
try{
|
||||||
|
console.log( instance.exports[scriptArgs[0]]( ...scriptArgs.slice(1) ) );
|
||||||
|
}catch(err){
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
instantiate( ret, dependencies ).then(
|
instantiate( ret, dependencies ).then(
|
||||||
instance => console.log( instance.exports[scriptArgs[0]]( ...scriptArgs.slice(1) ) ),
|
instance => callExport(instance),
|
||||||
reason => console.log(reason)
|
reason => console.log(reason)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user